diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 1d0033b1a73f..2d1785cd8bd2 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -412,6 +412,7 @@ com.azure.resourcemanager:azure-resourcemanager-newrelicobservability;1.0.0;1.1. com.azure.resourcemanager:azure-resourcemanager-qumulo;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-selfhelp;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-networkcloud;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index b839c84e1c62..50d7474d2e83 100644 --- a/pom.xml +++ b/pom.xml @@ -137,6 +137,7 @@ sdk/policyinsights sdk/postgresql sdk/postgresqlflexibleserver + sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver sdk/powerbidedicated sdk/providerhub sdk/purview diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/CHANGELOG.md b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/CHANGELOG.md new file mode 100644 index 000000000000..abada9dbdd77 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-05-25) + +- Azure Resource Manager PostgreSql client library for Java. This package contains Microsoft Azure SDK for PostgreSql Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations with new business model. Package tag package-flexibleserver-2022-12-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/README.md b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/README.md new file mode 100644 index 000000000000..873318ce2057 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/README.md @@ -0,0 +1,105 @@ +# Azure Resource Manager PostgreSql client library for Java + +Azure Resource Manager PostgreSql client library for Java. + +This package contains Microsoft Azure SDK for PostgreSql Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations with new business model. Package tag package-flexibleserver-2022-12-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[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 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 `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +PostgreSqlManager manager = PostgreSqlManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +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 +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/SAMPLE.md b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/SAMPLE.md new file mode 100644 index 000000000000..8ecbaf266a38 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/SAMPLE.md @@ -0,0 +1,1267 @@ +# Code snippets and samples + + +## Administrators + +- [Create](#administrators_create) +- [Delete](#administrators_delete) +- [Get](#administrators_get) +- [ListByServer](#administrators_listbyserver) + +## Backups + +- [Get](#backups_get) +- [ListByServer](#backups_listbyserver) + +## CheckNameAvailability + +- [Execute](#checknameavailability_execute) + +## CheckNameAvailabilityWithLocation + +- [Execute](#checknameavailabilitywithlocation_execute) + +## Configurations + +- [Get](#configurations_get) +- [ListByServer](#configurations_listbyserver) +- [Put](#configurations_put) +- [Update](#configurations_update) + +## Databases + +- [Create](#databases_create) +- [Delete](#databases_delete) +- [Get](#databases_get) +- [ListByServer](#databases_listbyserver) + +## FirewallRules + +- [CreateOrUpdate](#firewallrules_createorupdate) +- [Delete](#firewallrules_delete) +- [Get](#firewallrules_get) +- [ListByServer](#firewallrules_listbyserver) + +## GetPrivateDnsZoneSuffix + +- [Execute](#getprivatednszonesuffix_execute) + +## LocationBasedCapabilities + +- [Execute](#locationbasedcapabilities_execute) + +## Operations + +- [List](#operations_list) + +## Replicas + +- [ListByServer](#replicas_listbyserver) + +## Servers + +- [Create](#servers_create) +- [Delete](#servers_delete) +- [GetByResourceGroup](#servers_getbyresourcegroup) +- [List](#servers_list) +- [ListByResourceGroup](#servers_listbyresourcegroup) +- [Restart](#servers_restart) +- [Start](#servers_start) +- [Stop](#servers_stop) +- [Update](#servers_update) + +## VirtualNetworkSubnetUsage + +- [Execute](#virtualnetworksubnetusage_execute) +### Administrators_Create + +```java +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.PrincipalType; + +/** Samples for Administrators Create. */ +public final class AdministratorsCreateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/AdministratorAdd.json + */ + /** + * Sample code: Adds an Active DIrectory Administrator for the server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void addsAnActiveDIrectoryAdministratorForTheServer( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .administrators() + .define("oooooooo-oooo-oooo-oooo-oooooooooooo") + .withExistingFlexibleServer("testrg", "testserver") + .withPrincipalType(PrincipalType.USER) + .withPrincipalName("testuser1@microsoft.com") + .withTenantId("tttttttt-tttt-tttt-tttt-tttttttttttt") + .create(); + } +} +``` + +### Administrators_Delete + +```java +/** Samples for Administrators Delete. */ +public final class AdministratorsDeleteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/AdministratorDelete.json + */ + /** + * Sample code: AdministratorDelete. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void administratorDelete( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .administrators() + .delete("testrg", "testserver", "oooooooo-oooo-oooo-oooo-oooooooooooo", com.azure.core.util.Context.NONE); + } +} +``` + +### Administrators_Get + +```java +/** Samples for Administrators Get. */ +public final class AdministratorsGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/AdministratorGet.json + */ + /** + * Sample code: ServerGet. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverGet( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .administrators() + .getWithResponse( + "testrg", "pgtestsvc1", "oooooooo-oooo-oooo-oooo-oooooooooooo", com.azure.core.util.Context.NONE); + } +} +``` + +### Administrators_ListByServer + +```java +/** Samples for Administrators ListByServer. */ +public final class AdministratorsListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/AdministratorsListByServer.json + */ + /** + * Sample code: AdministratorsListByServer. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void administratorsListByServer( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.administrators().listByServer("testrg", "pgtestsvc1", com.azure.core.util.Context.NONE); + } +} +``` + +### Backups_Get + +```java +/** Samples for Backups Get. */ +public final class BackupsGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/BackupGet.json + */ + /** + * Sample code: Get a backup for a server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getABackupForAServer( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .backups() + .getWithResponse( + "TestGroup", "postgresqltestserver", "daily_20210615T160516", com.azure.core.util.Context.NONE); + } +} +``` + +### Backups_ListByServer + +```java +/** Samples for Backups ListByServer. */ +public final class BackupsListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/BackupListByServer.json + */ + /** + * Sample code: List backups for a server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void listBackupsForAServer( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.backups().listByServer("TestGroup", "postgresqltestserver", com.azure.core.util.Context.NONE); + } +} +``` + +### CheckNameAvailability_Execute + +```java +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilityRequest; + +/** Samples for CheckNameAvailability Execute. */ +public final class CheckNameAvailabilityExecuteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/CheckNameAvailability.json + */ + /** + * Sample code: NameAvailability. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void nameAvailability( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .checkNameAvailabilities() + .executeWithResponse( + new CheckNameAvailabilityRequest() + .withName("name1") + .withType("Microsoft.DBforPostgreSQL/flexibleServers"), + com.azure.core.util.Context.NONE); + } +} +``` + +### CheckNameAvailabilityWithLocation_Execute + +```java +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilityRequest; + +/** Samples for CheckNameAvailabilityWithLocation Execute. */ +public final class CheckNameAvailabilityWithLocationExecuteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/CheckNameAvailabilityLocationBased.json + */ + /** + * Sample code: NameAvailability. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void nameAvailability( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .checkNameAvailabilityWithLocations() + .executeWithResponse( + "westus", + new CheckNameAvailabilityRequest() + .withName("name1") + .withType("Microsoft.DBforPostgreSQL/flexibleServers"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Configurations_Get + +```java +/** Samples for Configurations Get. */ +public final class ConfigurationsGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ConfigurationGet.json + */ + /** + * Sample code: ConfigurationGet. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void configurationGet( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .configurations() + .getWithResponse("testrg", "testserver", "array_nulls", com.azure.core.util.Context.NONE); + } +} +``` + +### Configurations_ListByServer + +```java +/** Samples for Configurations ListByServer. */ +public final class ConfigurationsListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ConfigurationListByServer.json + */ + /** + * Sample code: ConfigurationList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void configurationList( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.configurations().listByServer("testrg", "testserver", com.azure.core.util.Context.NONE); + } +} +``` + +### Configurations_Put + +```java +/** Samples for Configurations Put. */ +public final class ConfigurationsPutSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ConfigurationUpdate.json + */ + /** + * Sample code: Update a user configuration. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void updateAUserConfiguration( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .configurations() + .define("event_scheduler") + .withExistingFlexibleServer("testrg", "testserver") + .withValue("on") + .withSource("user-override") + .create(); + } +} +``` + +### Configurations_Update + +```java +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Configuration; + +/** Samples for Configurations Update. */ +public final class ConfigurationsUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ConfigurationUpdate.json + */ + /** + * Sample code: Update a user configuration. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void updateAUserConfiguration( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + Configuration resource = + manager + .configurations() + .getWithResponse("testrg", "testserver", "event_scheduler", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withValue("on").withSource("user-override").apply(); + } +} +``` + +### Databases_Create + +```java +/** Samples for Databases Create. */ +public final class DatabasesCreateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/DatabaseCreate.json + */ + /** + * Sample code: Create a database. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createADatabase( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .databases() + .define("db1") + .withExistingFlexibleServer("TestGroup", "testserver") + .withCharset("utf8") + .withCollation("en_US.utf8") + .create(); + } +} +``` + +### Databases_Delete + +```java +/** Samples for Databases Delete. */ +public final class DatabasesDeleteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/DatabaseDelete.json + */ + /** + * Sample code: Delete a database. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void deleteADatabase( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.databases().delete("TestGroup", "testserver", "db1", com.azure.core.util.Context.NONE); + } +} +``` + +### Databases_Get + +```java +/** Samples for Databases Get. */ +public final class DatabasesGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/DatabaseGet.json + */ + /** + * Sample code: Get a database. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getADatabase( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.databases().getWithResponse("TestGroup", "testserver", "db1", com.azure.core.util.Context.NONE); + } +} +``` + +### Databases_ListByServer + +```java +/** Samples for Databases ListByServer. */ +public final class DatabasesListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/DatabasesListByServer.json + */ + /** + * Sample code: List databases in a server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void listDatabasesInAServer( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.databases().listByServer("TestGroup", "testserver", com.azure.core.util.Context.NONE); + } +} +``` + +### FirewallRules_CreateOrUpdate + +```java +/** Samples for FirewallRules CreateOrUpdate. */ +public final class FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/FirewallRuleCreate.json + */ + /** + * Sample code: FirewallRuleCreate. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void firewallRuleCreate( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .firewallRules() + .define("rule1") + .withExistingFlexibleServer("testrg", "testserver") + .withStartIpAddress("0.0.0.0") + .withEndIpAddress("255.255.255.255") + .create(); + } +} +``` + +### FirewallRules_Delete + +```java +/** Samples for FirewallRules Delete. */ +public final class FirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/FirewallRuleDelete.json + */ + /** + * Sample code: FirewallRuleDelete. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void firewallRuleDelete( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.firewallRules().delete("testrg", "testserver", "rule1", com.azure.core.util.Context.NONE); + } +} +``` + +### FirewallRules_Get + +```java +/** Samples for FirewallRules Get. */ +public final class FirewallRulesGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/FirewallRuleGet.json + */ + /** + * Sample code: FirewallRuleList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void firewallRuleList( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.firewallRules().getWithResponse("testrg", "testserver", "rule1", com.azure.core.util.Context.NONE); + } +} +``` + +### FirewallRules_ListByServer + +```java +/** Samples for FirewallRules ListByServer. */ +public final class FirewallRulesListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/FirewallRuleListByServer.json + */ + /** + * Sample code: FirewallRuleList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void firewallRuleList( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.firewallRules().listByServer("testrg", "testserver", com.azure.core.util.Context.NONE); + } +} +``` + +### GetPrivateDnsZoneSuffix_Execute + +```java +/** Samples for GetPrivateDnsZoneSuffix Execute. */ +public final class GetPrivateDnsZoneSuffixExecuteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/GetPrivateDnsZoneSuffix.json + */ + /** + * Sample code: GetPrivateDnsZoneSuffix. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getPrivateDnsZoneSuffix( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.getPrivateDnsZoneSuffixes().executeWithResponse(com.azure.core.util.Context.NONE); + } +} +``` + +### LocationBasedCapabilities_Execute + +```java +/** Samples for LocationBasedCapabilities Execute. */ +public final class LocationBasedCapabilitiesExecuteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/CapabilitiesByLocation.json + */ + /** + * Sample code: CapabilitiesList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void capabilitiesList( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.locationBasedCapabilities().execute("westus", com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/OperationList.json + */ + /** + * Sample code: OperationList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void operationList( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.operations().listWithResponse(com.azure.core.util.Context.NONE); + } +} +``` + +### Replicas_ListByServer + +```java +/** Samples for Replicas ListByServer. */ +public final class ReplicasListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ReplicasListByServer.json + */ + /** + * Sample code: ReplicasListByServer. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void replicasListByServer( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.replicas().listByServer("testrg", "sourcepgservername", com.azure.core.util.Context.NONE); + } +} +``` + +### Servers_Create + +```java +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ActiveDirectoryAuthEnum; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ArmServerKeyType; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.AuthConfig; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Backup; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CreateMode; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.DataEncryption; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.GeoRedundantBackupEnum; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.HighAvailability; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.HighAvailabilityMode; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.IdentityType; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Network; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.PasswordAuthEnum; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerVersion; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Sku; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.SkuTier; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Storage; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.UserAssignedIdentity; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.UserIdentity; +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/postgresql-flexibleserver/stable/2022-12-01/examples/ServerCreateWithDataEncryptionEnabled.json + */ + /** + * Sample code: ServerCreateWithDataEncryptionEnabled. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverCreateWithDataEncryptionEnabled( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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)) + .withIdentity( + new UserAssignedIdentity() + .withUserAssignedIdentities( + mapOf( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", + new UserIdentity())) + .withType(IdentityType.USER_ASSIGNED)) + .withAdministratorLogin("cloudsa") + .withAdministratorLoginPassword("password") + .withVersion(ServerVersion.ONE_TWO) + .withStorage(new Storage().withStorageSizeGB(512)) + .withDataEncryption( + new DataEncryption() + .withPrimaryKeyUri("fakeTokenPlaceholder") + .withPrimaryUserAssignedIdentityId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity") + .withType(ArmServerKeyType.AZURE_KEY_VAULT)) + .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) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerCreateGeoRestore.json + */ + /** + * Sample code: Create a database as a geo-restore in geo-paired location. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createADatabaseAsAGeoRestoreInGeoPairedLocation( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .servers() + .define("pgtestsvc5geo") + .withRegion("eastus") + .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.GEO_RESTORE) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerCreate.json + */ + /** + * Sample code: Create a new server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createANewServer( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerCreateWithAadAuthEnabled.json + */ + /** + * Sample code: Create a new server with active directory authentication enabled. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createANewServerWithActiveDirectoryAuthenticationEnabled( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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)) + .withAuthConfig( + new AuthConfig() + .withActiveDirectoryAuth(ActiveDirectoryAuthEnum.ENABLED) + .withPasswordAuth(PasswordAuthEnum.ENABLED) + .withTenantId("tttttt-tttt-tttt-tttt-tttttttttttt")) + .withDataEncryption(new DataEncryption().withType(ArmServerKeyType.SYSTEM_MANAGED)) + .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) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerCreateReplica.json + */ + /** + * Sample code: ServerCreateReplica. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverCreateReplica( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .servers() + .define("pgtestsvc5rep") + .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.REPLICA) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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(); + } + + @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 +/** Samples for Servers Delete. */ +public final class ServersDeleteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerDelete.json + */ + /** + * Sample code: ServerDelete. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverDelete( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.servers().delete("testrg", "testserver", com.azure.core.util.Context.NONE); + } +} +``` + +### Servers_GetByResourceGroup + +```java +/** Samples for Servers GetByResourceGroup. */ +public final class ServersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerGet.json + */ + /** + * Sample code: ServerGet. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverGet( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc1", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerGetWithVnet.json + */ + /** + * Sample code: ServerGetWithVnet. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverGetWithVnet( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE); + } +} +``` + +### Servers_List + +```java +/** Samples for Servers List. */ +public final class ServersListSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerList.json + */ + /** + * Sample code: ServerList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverList( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.servers().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Servers_ListByResourceGroup + +```java +/** Samples for Servers ListByResourceGroup. */ +public final class ServersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerListByResourceGroup.json + */ + /** + * Sample code: ServerListByResourceGroup. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverListByResourceGroup( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.servers().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} +``` + +### Servers_Restart + +```java +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.FailoverMode; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.RestartParameter; + +/** Samples for Servers Restart. */ +public final class ServersRestartSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerRestart.json + */ + /** + * Sample code: ServerRestart. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverRestart( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.servers().restart("testrg", "testserver", null, com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerRestartWithFailover.json + */ + /** + * Sample code: ServerRestartWithFailover. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverRestartWithFailover( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .servers() + .restart( + "testrg", + "testserver", + new RestartParameter().withRestartWithFailover(true).withFailoverMode(FailoverMode.FORCED_FAILOVER), + com.azure.core.util.Context.NONE); + } +} +``` + +### Servers_Start + +```java +/** Samples for Servers Start. */ +public final class ServersStartSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerStart.json + */ + /** + * Sample code: ServerStart. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverStart( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.servers().start("testrg", "testserver", com.azure.core.util.Context.NONE); + } +} +``` + +### Servers_Stop + +```java +/** Samples for Servers Stop. */ +public final class ServersStopSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerStop.json + */ + /** + * Sample code: ServerStop. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverStop( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.servers().stop("testrg", "testserver", com.azure.core.util.Context.NONE); + } +} +``` + +### Servers_Update + +```java +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ActiveDirectoryAuthEnum; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ArmServerKeyType; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.AuthConfig; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Backup; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CreateModeForUpdate; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.DataEncryption; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.IdentityType; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.PasswordAuthEnum; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Server; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerVersion; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Sku; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.SkuTier; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Storage; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.UserAssignedIdentity; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.UserIdentity; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Servers Update. */ +public final class ServersUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerUpdateWithAadAuthEnabled.json + */ + /** + * Sample code: ServerUpdateWithAadAuthEnabled. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverUpdateWithAadAuthEnabled( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + Server resource = + manager + .servers() + .getByResourceGroupWithResponse("TestGroup", "pgtestsvc4", com.azure.core.util.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)) + .withAuthConfig( + new AuthConfig() + .withActiveDirectoryAuth(ActiveDirectoryAuthEnum.ENABLED) + .withPasswordAuth(PasswordAuthEnum.ENABLED) + .withTenantId("tttttt-tttt-tttt-tttt-tttttttttttt")) + .withCreateMode(CreateModeForUpdate.UPDATE) + .apply(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerUpdateWithDataEncryptionEnabled.json + */ + /** + * Sample code: ServerUpdateWithDataEncryptionEnabled. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverUpdateWithDataEncryptionEnabled( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + Server resource = + manager + .servers() + .getByResourceGroupWithResponse("TestGroup", "pgtestsvc4", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("Standard_D8s_v3").withTier(SkuTier.GENERAL_PURPOSE)) + .withIdentity( + new UserAssignedIdentity() + .withUserAssignedIdentities( + mapOf( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", + new UserIdentity())) + .withType(IdentityType.USER_ASSIGNED)) + .withAdministratorLoginPassword("newpassword") + .withStorage(new Storage().withStorageSizeGB(1024)) + .withBackup(new Backup().withBackupRetentionDays(20)) + .withDataEncryption( + new DataEncryption() + .withPrimaryKeyUri("fakeTokenPlaceholder") + .withPrimaryUserAssignedIdentityId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity") + .withType(ArmServerKeyType.AZURE_KEY_VAULT)) + .withCreateMode(CreateModeForUpdate.UPDATE) + .apply(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerUpdate.json + */ + /** + * Sample code: ServerUpdate. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverUpdate( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + Server resource = + manager + .servers() + .getByResourceGroupWithResponse("TestGroup", "pgtestsvc4", com.azure.core.util.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/postgresql-flexibleserver/stable/2022-12-01/examples/ServerUpdateWithMajorVersionUpgrade.json + */ + /** + * Sample code: ServerUpdateWithMajorVersionUpgrade. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverUpdateWithMajorVersionUpgrade( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + Server resource = + manager + .servers() + .getByResourceGroupWithResponse("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withVersion(ServerVersion.ONE_FOUR).withCreateMode(CreateModeForUpdate.UPDATE).apply(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerUpdateWithCustomerMaintenanceWindow.json + */ + /** + * Sample code: ServerUpdateWithCustomerMaintenanceWindow. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverUpdateWithCustomerMaintenanceWindow( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + Server resource = + manager + .servers() + .getByResourceGroupWithResponse("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withMaintenanceWindow( + new MaintenanceWindow() + .withCustomWindow("Enabled") + .withStartHour(8) + .withStartMinute(0) + .withDayOfWeek(0)) + .withCreateMode(CreateModeForUpdate.UPDATE) + .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; + } +} +``` + +### VirtualNetworkSubnetUsage_Execute + +```java +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; + +/** Samples for VirtualNetworkSubnetUsage Execute. */ +public final class VirtualNetworkSubnetUsageExecuteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/VirtualNetworkSubnetUsage.json + */ + /** + * Sample code: VirtualNetworkSubnetUsageList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void virtualNetworkSubnetUsageList( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .virtualNetworkSubnetUsages() + .executeWithResponse( + "westus", + new VirtualNetworkSubnetUsageParameter() + .withVirtualNetworkArmResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/testvnet"), + com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/pom.xml b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/pom.xml new file mode 100644 index 000000000000..004c44cd60c6 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for PostgreSql Management + This package contains Microsoft Azure SDK for PostgreSql Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations with new business model. Package tag package-flexibleserver-2022-12-01. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + + + + com.azure + azure-core + 1.39.0 + + + com.azure + azure-core-management + 1.11.1 + + + diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/PostgreSqlManager.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/PostgreSqlManager.java new file mode 100644 index 000000000000..caf174225058 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/PostgreSqlManager.java @@ -0,0 +1,483 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver; + +import com.azure.core.credential.TokenCredential; +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; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.PostgreSqlManagementClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation.AdministratorsImpl; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation.BackupsImpl; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation.CheckNameAvailabilitiesImpl; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation.CheckNameAvailabilityWithLocationsImpl; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation.ConfigurationsImpl; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation.DatabasesImpl; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation.FirewallRulesImpl; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation.GetPrivateDnsZoneSuffixesImpl; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation.LocationBasedCapabilitiesImpl; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation.OperationsImpl; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation.PostgreSqlManagementClientBuilder; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation.ReplicasImpl; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation.ServersImpl; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation.VirtualNetworkSubnetUsagesImpl; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Administrators; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Backups; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilities; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilityWithLocations; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Configurations; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Databases; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.FirewallRules; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.GetPrivateDnsZoneSuffixes; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.LocationBasedCapabilities; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Operations; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Replicas; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Servers; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.VirtualNetworkSubnetUsages; +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 + * functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert + * policies, log files and configurations with new business model. + */ +public final class PostgreSqlManager { + private Administrators administrators; + + private Backups backups; + + private LocationBasedCapabilities locationBasedCapabilities; + + private CheckNameAvailabilities checkNameAvailabilities; + + private CheckNameAvailabilityWithLocations checkNameAvailabilityWithLocations; + + private Configurations configurations; + + private Databases databases; + + private FirewallRules firewallRules; + + private Servers servers; + + private Operations operations; + + private GetPrivateDnsZoneSuffixes getPrivateDnsZoneSuffixes; + + private Replicas replicas; + + private VirtualNetworkSubnetUsages virtualNetworkSubnetUsages; + + private final PostgreSqlManagementClient clientObject; + + private PostgreSqlManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new PostgreSqlManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of PostgreSql service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the PostgreSql service API instance. + */ + public static PostgreSqlManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + 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. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new PostgreSqlManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + 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() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + 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. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of PostgreSql service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the PostgreSql service API instance. + */ + public PostgreSqlManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + 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 + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new PostgreSqlManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Administrators. It manages ActiveDirectoryAdministrator. + * + * @return Resource collection API of Administrators. + */ + public Administrators administrators() { + if (this.administrators == null) { + this.administrators = new AdministratorsImpl(clientObject.getAdministrators(), this); + } + return administrators; + } + + /** + * Gets the resource collection API of Backups. + * + * @return Resource collection API of Backups. + */ + public Backups backups() { + if (this.backups == null) { + this.backups = new BackupsImpl(clientObject.getBackups(), this); + } + return backups; + } + + /** + * Gets the resource collection API of LocationBasedCapabilities. + * + * @return Resource collection API of LocationBasedCapabilities. + */ + public LocationBasedCapabilities locationBasedCapabilities() { + if (this.locationBasedCapabilities == null) { + this.locationBasedCapabilities = + new LocationBasedCapabilitiesImpl(clientObject.getLocationBasedCapabilities(), this); + } + return locationBasedCapabilities; + } + + /** + * Gets the resource collection API of CheckNameAvailabilities. + * + * @return Resource collection API of CheckNameAvailabilities. + */ + public CheckNameAvailabilities checkNameAvailabilities() { + if (this.checkNameAvailabilities == null) { + this.checkNameAvailabilities = + new CheckNameAvailabilitiesImpl(clientObject.getCheckNameAvailabilities(), this); + } + return checkNameAvailabilities; + } + + /** + * Gets the resource collection API of CheckNameAvailabilityWithLocations. + * + * @return Resource collection API of CheckNameAvailabilityWithLocations. + */ + public CheckNameAvailabilityWithLocations checkNameAvailabilityWithLocations() { + if (this.checkNameAvailabilityWithLocations == null) { + this.checkNameAvailabilityWithLocations = + new CheckNameAvailabilityWithLocationsImpl(clientObject.getCheckNameAvailabilityWithLocations(), this); + } + return checkNameAvailabilityWithLocations; + } + + /** + * 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); + } + return configurations; + } + + /** + * 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 FirewallRules. It manages FirewallRule. + * + * @return Resource collection API of FirewallRules. + */ + public FirewallRules firewallRules() { + if (this.firewallRules == null) { + this.firewallRules = new FirewallRulesImpl(clientObject.getFirewallRules(), this); + } + return firewallRules; + } + + /** + * 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); + } + return servers; + } + + /** + * 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 operations; + } + + /** + * Gets the resource collection API of GetPrivateDnsZoneSuffixes. + * + * @return Resource collection API of GetPrivateDnsZoneSuffixes. + */ + public GetPrivateDnsZoneSuffixes getPrivateDnsZoneSuffixes() { + if (this.getPrivateDnsZoneSuffixes == null) { + this.getPrivateDnsZoneSuffixes = + new GetPrivateDnsZoneSuffixesImpl(clientObject.getGetPrivateDnsZoneSuffixes(), this); + } + return getPrivateDnsZoneSuffixes; + } + + /** + * 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 VirtualNetworkSubnetUsages. + * + * @return Resource collection API of VirtualNetworkSubnetUsages. + */ + public VirtualNetworkSubnetUsages virtualNetworkSubnetUsages() { + if (this.virtualNetworkSubnetUsages == null) { + this.virtualNetworkSubnetUsages = + new VirtualNetworkSubnetUsagesImpl(clientObject.getVirtualNetworkSubnetUsages(), this); + } + return virtualNetworkSubnetUsages; + } + + /** + * @return Wrapped service client PostgreSqlManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public PostgreSqlManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/AdministratorsClient.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/AdministratorsClient.java new file mode 100644 index 000000000000..15741e4324ad --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/AdministratorsClient.java @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ActiveDirectoryAdministratorInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ActiveDirectoryAdministratorAdd; +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 AdministratorsClient. */ +public interface AdministratorsClient { + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for 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 represents an Active Directory administrator along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, String objectId, ActiveDirectoryAdministratorAdd parameters); + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents an Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ActiveDirectoryAdministratorInner> beginCreateAsync( + String resourceGroupName, String serverName, String objectId, ActiveDirectoryAdministratorAdd parameters); + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents an Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ActiveDirectoryAdministratorInner> beginCreate( + String resourceGroupName, String serverName, String objectId, ActiveDirectoryAdministratorAdd parameters); + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for 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 {@link SyncPoller} for polling of represents an Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ActiveDirectoryAdministratorInner> beginCreate( + String resourceGroupName, + String serverName, + String objectId, + ActiveDirectoryAdministratorAdd parameters, + Context context); + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for 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 represents an Active Directory administrator on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createAsync( + String resourceGroupName, String serverName, String objectId, ActiveDirectoryAdministratorAdd parameters); + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for 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 represents an Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActiveDirectoryAdministratorInner create( + String resourceGroupName, String serverName, String objectId, ActiveDirectoryAdministratorAdd parameters); + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for 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 represents an Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActiveDirectoryAdministratorInner create( + String resourceGroupName, + String serverName, + String objectId, + ActiveDirectoryAdministratorAdd parameters, + Context context); + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String objectId); + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName, String objectId); + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String objectId); + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String objectId, Context context); + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(String resourceGroupName, String serverName, String objectId); + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String objectId); + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String objectId, 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 objectId Guid of the objectId for the 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 information about a server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String objectId); + + /** + * 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 objectId Guid of the objectId for the 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 information about a server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(String resourceGroupName, String serverName, String objectId); + + /** + * 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 objectId Guid of the objectId for the 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 information about a server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String objectId, 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 objectId Guid of the objectId for the 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 information about a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActiveDirectoryAdministratorInner get(String resourceGroupName, String serverName, String objectId); + + /** + * List all the AAD administrators 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 active directory administrators as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(String resourceGroupName, String serverName); + + /** + * List all the AAD administrators 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 active directory administrators as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the AAD administrators 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 active directory administrators as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/BackupsClient.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/BackupsClient.java new file mode 100644 index 000000000000..9637c51eae40 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/BackupsClient.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerBackupInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BackupsClient. */ +public interface BackupsClient { + /** + * Get specific backup 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 backupName The name of the backup. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific backup for a given server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String backupName); + + /** + * Get specific backup 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 backupName The name of the backup. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific backup for a given server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(String resourceGroupName, String serverName, String backupName); + + /** + * Get specific backup 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 backupName The name of the backup. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific backup for a given server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String backupName, Context context); + + /** + * Get specific backup 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 backupName The name of the backup. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific backup for a given server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerBackupInner get(String resourceGroupName, String serverName, String backupName); + + /** + * List all the backups 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 server backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(String resourceGroupName, String serverName); + + /** + * List all the backups 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 server backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the backups 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 server backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/CheckNameAvailabilitiesClient.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/CheckNameAvailabilitiesClient.java new file mode 100644 index 000000000000..e531905b7bcd --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/CheckNameAvailabilitiesClient.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilityRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CheckNameAvailabilitiesClient. */ +public interface CheckNameAvailabilitiesClient { + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> executeWithResponseAsync( + CheckNameAvailabilityRequest nameAvailabilityRequest); + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono executeAsync(CheckNameAvailabilityRequest nameAvailabilityRequest); + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response executeWithResponse( + CheckNameAvailabilityRequest nameAvailabilityRequest, Context context); + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NameAvailabilityInner execute(CheckNameAvailabilityRequest nameAvailabilityRequest); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/CheckNameAvailabilityWithLocationsClient.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/CheckNameAvailabilityWithLocationsClient.java new file mode 100644 index 000000000000..8a4f1b1047f8 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/CheckNameAvailabilityWithLocationsClient.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilityRequest; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CheckNameAvailabilityWithLocationsClient. + */ +public interface CheckNameAvailabilityWithLocationsClient { + /** + * Check the availability of name for resource. + * + * @param locationName The name of the location. + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> executeWithResponseAsync( + String locationName, CheckNameAvailabilityRequest nameAvailabilityRequest); + + /** + * Check the availability of name for resource. + * + * @param locationName The name of the location. + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono executeAsync(String locationName, CheckNameAvailabilityRequest nameAvailabilityRequest); + + /** + * Check the availability of name for resource. + * + * @param locationName The name of the location. + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response executeWithResponse( + String locationName, CheckNameAvailabilityRequest nameAvailabilityRequest, Context context); + + /** + * Check the availability of name for resource. + * + * @param locationName The name of the location. + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NameAvailabilityInner execute(String locationName, CheckNameAvailabilityRequest nameAvailabilityRequest); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/ConfigurationsClient.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/ConfigurationsClient.java new file mode 100644 index 000000000000..2483ec9fc6fd --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/ConfigurationsClient.java @@ -0,0 +1,367 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ConfigurationForUpdate; +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 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getWithResponseAsync( + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String configurationName, 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); + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationForUpdate parameters); + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 Configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ConfigurationInner> beginUpdateAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationForUpdate parameters); + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 Configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ConfigurationInner> beginUpdate( + String resourceGroupName, String serverName, String configurationName, ConfigurationForUpdate parameters); + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ConfigurationInner> beginUpdate( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationForUpdate parameters, + Context 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 com.azure.core.management.exception.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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono updateAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationForUpdate parameters); + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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.SINGLE) + ConfigurationInner update( + String resourceGroupName, String serverName, String configurationName, ConfigurationForUpdate parameters); + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationInner update( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationForUpdate parameters, + Context 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 com.azure.core.management.exception.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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> putWithResponseAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters); + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 Configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ConfigurationInner> beginPutAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters); + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 Configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ConfigurationInner> beginPut( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters); + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ConfigurationInner> beginPut( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationInner parameters, + Context 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 com.azure.core.management.exception.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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono putAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters); + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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.SINGLE) + ConfigurationInner put( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters); + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationInner put( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationInner parameters, + Context context); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/DatabasesClient.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/DatabasesClient.java new file mode 100644 index 000000000000..05bae8b286d3 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/DatabasesClient.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.DatabaseInner; +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 DatabasesClient. */ +public interface DatabasesClient { + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); + + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a Database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, DatabaseInner> beginCreateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); + + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DatabaseInner> beginCreate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); + + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DatabaseInner> beginCreate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context); + + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); + + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner create(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); + + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a 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 represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner create( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context); + + /** + * Deletes a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String databaseName); + + /** + * Deletes a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName); + + /** + * Deletes a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 databaseName); + + /** + * Deletes a database. + * + * @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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Deletes a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Deletes a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 databaseName); + + /** + * Deletes a database. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets information about a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets information about a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets information about a database. + * + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets information about a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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) + DatabaseInner get(String resourceGroupName, String serverName, String databaseName); + + /** + * List all the databases 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 databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(String resourceGroupName, String serverName); + + /** + * List all the databases 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 databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the databases 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 databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/FirewallRulesClient.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/FirewallRulesClient.java new file mode 100644 index 000000000000..a0fa53af6d49 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/FirewallRulesClient.java @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.FirewallRuleInner; +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 FirewallRulesClient. */ +public interface FirewallRulesClient { + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a firewall 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 represents a server firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters); + + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a firewall 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 PollerFlux} for polling of represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters); + + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a firewall 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 represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters); + + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a 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 the {@link SyncPoller} for polling of represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context); + + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a firewall 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 represents a server firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters); + + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a firewall 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 represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner createOrUpdate( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters); + + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context); + + /** + * Deletes a PostgreSQL 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Deletes a PostgreSQL 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Deletes a PostgreSQL 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 firewallRuleName); + + /** + * Deletes a PostgreSQL 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 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. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Deletes a PostgreSQL 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 firewallRuleName); + + /** + * Deletes a PostgreSQL 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * 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. + * @param firewallRuleName The name of the server firewall 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 represents a server firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName); + + /** + * 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. + * @param firewallRuleName The name of the server firewall 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 represents a server firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * 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. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * 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. + * @param firewallRuleName The name of the server firewall 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 represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * List all the firewall rules in a given 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 firewall rules as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(String resourceGroupName, String serverName); + + /** + * List all the firewall rules in a given 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 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. + * + * @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 firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/GetPrivateDnsZoneSuffixesClient.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/GetPrivateDnsZoneSuffixesClient.java new file mode 100644 index 000000000000..1413a774fd21 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/GetPrivateDnsZoneSuffixesClient.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import reactor.core.publisher.Mono; + +/** 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> executeWithResponseAsync(); + + /** + * 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono executeAsync(); + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response executeWithResponse(Context context); + + /** + * 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(); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/LocationBasedCapabilitiesClient.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/LocationBasedCapabilitiesClient.java new file mode 100644 index 000000000000..63457c0c4e88 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/LocationBasedCapabilitiesClient.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; + +/** An instance of this class provides access to all the operations defined in LocationBasedCapabilitiesClient. */ +public interface LocationBasedCapabilitiesClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capabilities at specified location in a given subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux executeAsync(String locationName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capabilities at specified location in a given subscription as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable execute(String 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capabilities at specified location in a given subscription as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable execute(String locationName, Context context); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/OperationsClient.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/OperationsClient.java new file mode 100644 index 000000000000..e690e2238ae5 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/OperationsClient.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.OperationListResultInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> listWithResponseAsync(); + + /** + * Lists all of the available REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono listAsync(); + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); + + /** + * Lists all of the available REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationListResultInner list(); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/PostgreSqlManagementClient.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/PostgreSqlManagementClient.java new file mode 100644 index 000000000000..fa0bf0cbe6c4 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/PostgreSqlManagementClient.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for PostgreSqlManagementClient class. */ +public interface PostgreSqlManagementClient { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the AdministratorsClient object to access its operations. + * + * @return the AdministratorsClient object. + */ + AdministratorsClient getAdministrators(); + + /** + * Gets the BackupsClient object to access its operations. + * + * @return the BackupsClient object. + */ + BackupsClient getBackups(); + + /** + * Gets the LocationBasedCapabilitiesClient object to access its operations. + * + * @return the LocationBasedCapabilitiesClient object. + */ + LocationBasedCapabilitiesClient getLocationBasedCapabilities(); + + /** + * Gets the CheckNameAvailabilitiesClient object to access its operations. + * + * @return the CheckNameAvailabilitiesClient object. + */ + CheckNameAvailabilitiesClient getCheckNameAvailabilities(); + + /** + * Gets the CheckNameAvailabilityWithLocationsClient object to access its operations. + * + * @return the CheckNameAvailabilityWithLocationsClient object. + */ + CheckNameAvailabilityWithLocationsClient getCheckNameAvailabilityWithLocations(); + + /** + * Gets the ConfigurationsClient object to access its operations. + * + * @return the ConfigurationsClient object. + */ + ConfigurationsClient getConfigurations(); + + /** + * Gets the DatabasesClient object to access its operations. + * + * @return the DatabasesClient object. + */ + DatabasesClient getDatabases(); + + /** + * Gets the FirewallRulesClient object to access its operations. + * + * @return the FirewallRulesClient object. + */ + FirewallRulesClient getFirewallRules(); + + /** + * Gets the ServersClient object to access its operations. + * + * @return the ServersClient object. + */ + ServersClient getServers(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the GetPrivateDnsZoneSuffixesClient object to access its operations. + * + * @return the GetPrivateDnsZoneSuffixesClient object. + */ + GetPrivateDnsZoneSuffixesClient getGetPrivateDnsZoneSuffixes(); + + /** + * Gets the ReplicasClient object to access its operations. + * + * @return the ReplicasClient object. + */ + ReplicasClient getReplicas(); + + /** + * Gets the VirtualNetworkSubnetUsagesClient object to access its operations. + * + * @return the VirtualNetworkSubnetUsagesClient object. + */ + VirtualNetworkSubnetUsagesClient getVirtualNetworkSubnetUsages(); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/ReplicasClient.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/ReplicasClient.java new file mode 100644 index 000000000000..f2ed30b8a6f7 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/ReplicasClient.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/ServersClient.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/ServersClient.java new file mode 100644 index 000000000000..32ef69f32023 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/ServersClient.java @@ -0,0 +1,759 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.RestartParameter; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerForUpdate; +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 interface ServersClient { + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, ServerInner parameters); + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ServerInner> beginCreateAsync( + String resourceGroupName, String serverName, ServerInner parameters); + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerInner> beginCreate( + String resourceGroupName, String serverName, ServerInner parameters); + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @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); + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createAsync(String resourceGroupName, String serverName, ServerInner parameters); + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner create(String resourceGroupName, String serverName, ServerInner parameters); + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner create(String resourceGroupName, String serverName, ServerInner parameters, Context context); + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, ServerForUpdate parameters); + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ServerInner> beginUpdateAsync( + String resourceGroupName, String serverName, ServerForUpdate parameters); + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerInner> beginUpdate( + String resourceGroupName, String serverName, ServerForUpdate parameters); + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @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); + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono updateAsync(String resourceGroupName, String serverName, ServerForUpdate parameters); + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner update(String resourceGroupName, String serverName, ServerForUpdate parameters); + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner update(String resourceGroupName, String serverName, ServerForUpdate parameters, Context context); + + /** + * Deletes 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync(String resourceGroupName, String serverName); + + /** + * Deletes 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName); + + /** + * Deletes 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName); + + /** + * Deletes 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, Context context); + + /** + * Deletes 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(String resourceGroupName, String serverName); + + /** + * Deletes 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 delete(String resourceGroupName, String serverName); + + /** + * Deletes 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 delete(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String serverName); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getByResourceGroupAsync(String resourceGroupName, String serverName); + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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) + ServerInner getByResourceGroup(String resourceGroupName, String serverName); + + /** + * List all the servers in a given resource group. + * + * @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 a list of servers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByResourceGroupAsync(String resourceGroupName); + + /** + * List all the servers in a given resource group. + * + * @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 a list of servers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all the servers in a given resource group. + * + * @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 a list of servers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List all the servers in a given subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if 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) + PagedFlux listAsync(); + + /** + * List all the servers in a given subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if 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 list(); + + /** + * List all the servers in a given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 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. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> restartWithResponseAsync( + String resourceGroupName, String serverName, RestartParameter parameters); + + /** + * 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. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String serverName, RestartParameter parameters); + + /** + * Restarts 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginRestartAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart(String resourceGroupName, String serverName); + + /** + * 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 {@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. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono restartAsync(String resourceGroupName, String serverName, RestartParameter parameters); + + /** + * Restarts 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono restartAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * 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. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> startWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + PollerFlux, Void> beginStartAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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> 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 {@link SyncPoller} for polling of long-running operation. + */ + @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. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono startAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> stopWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + PollerFlux, Void> beginStopAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStop(String resourceGroupName, String serverName); + + /** + * 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 {@link SyncPoller} for polling of long-running operation. + */ + @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. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono stopAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/VirtualNetworkSubnetUsagesClient.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/VirtualNetworkSubnetUsagesClient.java new file mode 100644 index 000000000000..4484d12b634a --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/VirtualNetworkSubnetUsagesClient.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualNetworkSubnetUsagesClient. */ +public interface VirtualNetworkSubnetUsagesClient { + /** + * Get virtual network subnet usage for a given vNet resource id. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual network subnet usage for a given vNet resource id along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> executeWithResponseAsync( + String locationName, VirtualNetworkSubnetUsageParameter parameters); + + /** + * Get virtual network subnet usage for a given vNet resource id. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual network subnet usage for a given vNet resource id on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono executeAsync( + String locationName, VirtualNetworkSubnetUsageParameter parameters); + + /** + * Get virtual network subnet usage for a given vNet resource id. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual network subnet usage for a given vNet resource id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response executeWithResponse( + String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context); + + /** + * Get virtual network subnet usage for a given vNet resource id. + * + * @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 com.azure.core.management.exception.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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkSubnetUsageResultInner execute(String locationName, VirtualNetworkSubnetUsageParameter parameters); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ActiveDirectoryAdministratorInner.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ActiveDirectoryAdministratorInner.java new file mode 100644 index 000000000000..c6d9ef854400 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ActiveDirectoryAdministratorInner.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.PrincipalType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents an Active Directory administrator. */ +@Fluent +public final class ActiveDirectoryAdministratorInner extends ProxyResource { + /* + * Properties of the active directory administrator. + */ + @JsonProperty(value = "properties", required = true) + private AdministratorProperties innerProperties = new AdministratorProperties(); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of ActiveDirectoryAdministratorInner class. */ + public ActiveDirectoryAdministratorInner() { + } + + /** + * Get the innerProperties property: Properties of the active directory administrator. + * + * @return the innerProperties value. + */ + private AdministratorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the principalType property: The principal type used to represent the type of Active Directory Administrator. + * + * @return the principalType value. + */ + public PrincipalType principalType() { + return this.innerProperties() == null ? null : this.innerProperties().principalType(); + } + + /** + * Set the principalType property: The principal type used to represent the type of Active Directory Administrator. + * + * @param principalType the principalType value to set. + * @return the ActiveDirectoryAdministratorInner object itself. + */ + public ActiveDirectoryAdministratorInner withPrincipalType(PrincipalType principalType) { + if (this.innerProperties() == null) { + this.innerProperties = new AdministratorProperties(); + } + this.innerProperties().withPrincipalType(principalType); + return this; + } + + /** + * Get the principalName property: Active Directory administrator principal name. + * + * @return the principalName value. + */ + public String principalName() { + return this.innerProperties() == null ? null : this.innerProperties().principalName(); + } + + /** + * Set the principalName property: Active Directory administrator principal name. + * + * @param principalName the principalName value to set. + * @return the ActiveDirectoryAdministratorInner object itself. + */ + public ActiveDirectoryAdministratorInner withPrincipalName(String principalName) { + if (this.innerProperties() == null) { + this.innerProperties = new AdministratorProperties(); + } + this.innerProperties().withPrincipalName(principalName); + return this; + } + + /** + * Get the objectId property: The objectId of the Active Directory administrator. + * + * @return the objectId value. + */ + public String objectId() { + return this.innerProperties() == null ? null : this.innerProperties().objectId(); + } + + /** + * Set the objectId property: The objectId of the Active Directory administrator. + * + * @param objectId the objectId value to set. + * @return the ActiveDirectoryAdministratorInner object itself. + */ + public ActiveDirectoryAdministratorInner withObjectId(String objectId) { + if (this.innerProperties() == null) { + this.innerProperties = new AdministratorProperties(); + } + this.innerProperties().withObjectId(objectId); + return this; + } + + /** + * Get the tenantId property: The tenantId of the Active Directory administrator. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenantId of the Active Directory administrator. + * + * @param tenantId the tenantId value to set. + * @return the ActiveDirectoryAdministratorInner object itself. + */ + public ActiveDirectoryAdministratorInner withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new AdministratorProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model ActiveDirectoryAdministratorInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActiveDirectoryAdministratorInner.class); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/AdministratorProperties.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/AdministratorProperties.java new file mode 100644 index 000000000000..a0fe84dc6d0d --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/AdministratorProperties.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.PrincipalType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Active Directory administrator. */ +@Fluent +public final class AdministratorProperties { + /* + * The principal type used to represent the type of Active Directory Administrator. + */ + @JsonProperty(value = "principalType") + private PrincipalType principalType; + + /* + * Active Directory administrator principal name. + */ + @JsonProperty(value = "principalName") + private String principalName; + + /* + * The objectId of the Active Directory administrator. + */ + @JsonProperty(value = "objectId") + private String objectId; + + /* + * The tenantId of the Active Directory administrator. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /** Creates an instance of AdministratorProperties class. */ + public AdministratorProperties() { + } + + /** + * Get the principalType property: The principal type used to represent the type of Active Directory Administrator. + * + * @return the principalType value. + */ + public PrincipalType principalType() { + return this.principalType; + } + + /** + * Set the principalType property: The principal type used to represent the type of Active Directory Administrator. + * + * @param principalType the principalType value to set. + * @return the AdministratorProperties object itself. + */ + public AdministratorProperties withPrincipalType(PrincipalType principalType) { + this.principalType = principalType; + return this; + } + + /** + * Get the principalName property: Active Directory administrator principal name. + * + * @return the principalName value. + */ + public String principalName() { + return this.principalName; + } + + /** + * Set the principalName property: Active Directory administrator principal name. + * + * @param principalName the principalName value to set. + * @return the AdministratorProperties object itself. + */ + public AdministratorProperties withPrincipalName(String principalName) { + this.principalName = principalName; + return this; + } + + /** + * Get the objectId property: The objectId of the Active Directory administrator. + * + * @return the objectId value. + */ + public String objectId() { + return this.objectId; + } + + /** + * Set the objectId property: The objectId of the Active Directory administrator. + * + * @param objectId the objectId value to set. + * @return the AdministratorProperties object itself. + */ + public AdministratorProperties withObjectId(String objectId) { + this.objectId = objectId; + return this; + } + + /** + * Get the tenantId property: The tenantId of the Active Directory administrator. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The tenantId of the Active Directory administrator. + * + * @param tenantId the tenantId value to set. + * @return the AdministratorProperties object itself. + */ + public AdministratorProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/AdministratorPropertiesForAdd.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/AdministratorPropertiesForAdd.java new file mode 100644 index 000000000000..c28c26af6477 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/AdministratorPropertiesForAdd.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.PrincipalType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Active Directory administrator. */ +@Fluent +public final class AdministratorPropertiesForAdd { + /* + * The principal type used to represent the type of Active Directory Administrator. + */ + @JsonProperty(value = "principalType") + private PrincipalType principalType; + + /* + * Active Directory administrator principal name. + */ + @JsonProperty(value = "principalName") + private String principalName; + + /* + * The tenantId of the Active Directory administrator. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /** Creates an instance of AdministratorPropertiesForAdd class. */ + public AdministratorPropertiesForAdd() { + } + + /** + * Get the principalType property: The principal type used to represent the type of Active Directory Administrator. + * + * @return the principalType value. + */ + public PrincipalType principalType() { + return this.principalType; + } + + /** + * Set the principalType property: The principal type used to represent the type of Active Directory Administrator. + * + * @param principalType the principalType value to set. + * @return the AdministratorPropertiesForAdd object itself. + */ + public AdministratorPropertiesForAdd withPrincipalType(PrincipalType principalType) { + this.principalType = principalType; + return this; + } + + /** + * Get the principalName property: Active Directory administrator principal name. + * + * @return the principalName value. + */ + public String principalName() { + return this.principalName; + } + + /** + * Set the principalName property: Active Directory administrator principal name. + * + * @param principalName the principalName value to set. + * @return the AdministratorPropertiesForAdd object itself. + */ + public AdministratorPropertiesForAdd withPrincipalName(String principalName) { + this.principalName = principalName; + return this; + } + + /** + * Get the tenantId property: The tenantId of the Active Directory administrator. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The tenantId of the Active Directory administrator. + * + * @param tenantId the tenantId value to set. + * @return the AdministratorPropertiesForAdd object itself. + */ + public AdministratorPropertiesForAdd withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/CapabilityPropertiesInner.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/CapabilityPropertiesInner.java new file mode 100644 index 000000000000..e638b4605aae --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/CapabilityPropertiesInner.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.FastProvisioningEditionCapability; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.FlexibleServerEditionCapability; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.HyperscaleNodeEditionCapability; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Location capabilities. */ +@Immutable +public final class CapabilityPropertiesInner { + /* + * zone name + */ + @JsonProperty(value = "zone", access = JsonProperty.Access.WRITE_ONLY) + private String zone; + + /* + * Supported high availability mode + */ + @JsonProperty(value = "supportedHAMode", access = JsonProperty.Access.WRITE_ONLY) + private List supportedHAMode; + + /* + * A value indicating whether a new server in this region can have geo-backups to paired region. + */ + @JsonProperty(value = "geoBackupSupported", access = JsonProperty.Access.WRITE_ONLY) + private Boolean geoBackupSupported; + + /* + * A value indicating whether a new server in this region can support multi zone HA. + */ + @JsonProperty(value = "zoneRedundantHaSupported", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundantHaSupported; + + /* + * A value indicating whether a new server in this region can have geo-backups to paired region. + */ + @JsonProperty(value = "zoneRedundantHaAndGeoBackupSupported", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundantHaAndGeoBackupSupported; + + /* + * The supportedFlexibleServerEditions property. + */ + @JsonProperty(value = "supportedFlexibleServerEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedFlexibleServerEditions; + + /* + * The supportedHyperscaleNodeEditions property. + */ + @JsonProperty(value = "supportedHyperscaleNodeEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedHyperscaleNodeEditions; + + /* + * A value indicating whether fast provisioning is supported in this region. + */ + @JsonProperty(value = "fastProvisioningSupported", access = JsonProperty.Access.WRITE_ONLY) + private Boolean fastProvisioningSupported; + + /* + * The supportedFastProvisioningEditions property. + */ + @JsonProperty(value = "supportedFastProvisioningEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedFastProvisioningEditions; + + /* + * The status + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** Creates an instance of CapabilityPropertiesInner class. */ + public CapabilityPropertiesInner() { + } + + /** + * Get the zone property: zone name. + * + * @return the zone value. + */ + public String zone() { + return this.zone; + } + + /** + * Get the supportedHAMode property: Supported high availability mode. + * + * @return the supportedHAMode value. + */ + public List supportedHAMode() { + return this.supportedHAMode; + } + + /** + * Get the geoBackupSupported property: A value indicating whether a new server in this region can have geo-backups + * to paired region. + * + * @return the geoBackupSupported value. + */ + public Boolean geoBackupSupported() { + return this.geoBackupSupported; + } + + /** + * Get the zoneRedundantHaSupported property: A value indicating whether a new server in this region can support + * multi zone HA. + * + * @return the zoneRedundantHaSupported value. + */ + public Boolean zoneRedundantHaSupported() { + return this.zoneRedundantHaSupported; + } + + /** + * Get the zoneRedundantHaAndGeoBackupSupported property: A value indicating whether a new server in this region can + * have geo-backups to paired region. + * + * @return the zoneRedundantHaAndGeoBackupSupported value. + */ + public Boolean zoneRedundantHaAndGeoBackupSupported() { + return this.zoneRedundantHaAndGeoBackupSupported; + } + + /** + * Get the supportedFlexibleServerEditions property: The supportedFlexibleServerEditions property. + * + * @return the supportedFlexibleServerEditions value. + */ + public List supportedFlexibleServerEditions() { + return this.supportedFlexibleServerEditions; + } + + /** + * Get the supportedHyperscaleNodeEditions property: The supportedHyperscaleNodeEditions property. + * + * @return the supportedHyperscaleNodeEditions value. + */ + public List supportedHyperscaleNodeEditions() { + return this.supportedHyperscaleNodeEditions; + } + + /** + * Get the fastProvisioningSupported property: A value indicating whether fast provisioning is supported in this + * region. + * + * @return the fastProvisioningSupported value. + */ + public Boolean fastProvisioningSupported() { + return this.fastProvisioningSupported; + } + + /** + * Get the supportedFastProvisioningEditions property: The supportedFastProvisioningEditions property. + * + * @return the supportedFastProvisioningEditions value. + */ + public List supportedFastProvisioningEditions() { + return this.supportedFastProvisioningEditions; + } + + /** + * Get the status property: The status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedFlexibleServerEditions() != null) { + supportedFlexibleServerEditions().forEach(e -> e.validate()); + } + if (supportedHyperscaleNodeEditions() != null) { + supportedHyperscaleNodeEditions().forEach(e -> e.validate()); + } + if (supportedFastProvisioningEditions() != null) { + supportedFastProvisioningEditions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ConfigurationInner.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ConfigurationInner.java new file mode 100644 index 000000000000..f4c2376bc9a1 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ConfigurationInner.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ConfigurationDataType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a Configuration. */ +@Fluent +public final class ConfigurationInner extends ProxyResource { + /* + * The properties of a configuration. + */ + @JsonProperty(value = "properties") + private ConfigurationProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of ConfigurationInner class. */ + public ConfigurationInner() { + } + + /** + * Get the innerProperties property: The properties of a configuration. + * + * @return the innerProperties value. + */ + private ConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the value property: Value of the configuration. + * + * @return the value value. + */ + public String value() { + return this.innerProperties() == null ? null : this.innerProperties().value(); + } + + /** + * Set the value property: Value of the configuration. + * + * @param value the value value to set. + * @return the ConfigurationInner object itself. + */ + public ConfigurationInner withValue(String value) { + if (this.innerProperties() == null) { + this.innerProperties = new ConfigurationProperties(); + } + this.innerProperties().withValue(value); + return this; + } + + /** + * Get the description property: Description of the configuration. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the defaultValue property: Default value of the configuration. + * + * @return the defaultValue value. + */ + public String defaultValue() { + return this.innerProperties() == null ? null : this.innerProperties().defaultValue(); + } + + /** + * Get the dataType property: Data type of the configuration. + * + * @return the dataType value. + */ + public ConfigurationDataType dataType() { + return this.innerProperties() == null ? null : this.innerProperties().dataType(); + } + + /** + * Get the allowedValues property: Allowed values of the configuration. + * + * @return the allowedValues value. + */ + public String allowedValues() { + return this.innerProperties() == null ? null : this.innerProperties().allowedValues(); + } + + /** + * Get the source property: Source of the configuration. + * + * @return the source value. + */ + public String source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Set the source property: Source of the configuration. + * + * @param source the source value to set. + * @return the ConfigurationInner object itself. + */ + public ConfigurationInner withSource(String source) { + if (this.innerProperties() == null) { + this.innerProperties = new ConfigurationProperties(); + } + this.innerProperties().withSource(source); + return this; + } + + /** + * Get the isDynamicConfig property: Configuration dynamic or static. + * + * @return the isDynamicConfig value. + */ + public Boolean isDynamicConfig() { + return this.innerProperties() == null ? null : this.innerProperties().isDynamicConfig(); + } + + /** + * Get the isReadOnly property: Configuration read-only or not. + * + * @return the isReadOnly value. + */ + public Boolean isReadOnly() { + return this.innerProperties() == null ? null : this.innerProperties().isReadOnly(); + } + + /** + * Get the isConfigPendingRestart property: Configuration is pending restart or not. + * + * @return the isConfigPendingRestart value. + */ + public Boolean isConfigPendingRestart() { + return this.innerProperties() == null ? null : this.innerProperties().isConfigPendingRestart(); + } + + /** + * Get the unit property: Configuration unit. + * + * @return the unit value. + */ + public String unit() { + return this.innerProperties() == null ? null : this.innerProperties().unit(); + } + + /** + * Get the documentationLink property: Configuration documentation link. + * + * @return the documentationLink value. + */ + public String documentationLink() { + return this.innerProperties() == null ? null : this.innerProperties().documentationLink(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ConfigurationProperties.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ConfigurationProperties.java new file mode 100644 index 000000000000..56f65da88753 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ConfigurationProperties.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ConfigurationDataType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a configuration. */ +@Fluent +public final class ConfigurationProperties { + /* + * Value of the configuration. + */ + @JsonProperty(value = "value") + private String value; + + /* + * Description of the configuration. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Default value of the configuration. + */ + @JsonProperty(value = "defaultValue", access = JsonProperty.Access.WRITE_ONLY) + private String defaultValue; + + /* + * Data type of the configuration. + */ + @JsonProperty(value = "dataType", access = JsonProperty.Access.WRITE_ONLY) + private ConfigurationDataType dataType; + + /* + * Allowed values of the configuration. + */ + @JsonProperty(value = "allowedValues", access = JsonProperty.Access.WRITE_ONLY) + private String allowedValues; + + /* + * Source of the configuration. + */ + @JsonProperty(value = "source") + private String source; + + /* + * Configuration dynamic or static. + */ + @JsonProperty(value = "isDynamicConfig", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDynamicConfig; + + /* + * Configuration read-only or not. + */ + @JsonProperty(value = "isReadOnly", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isReadOnly; + + /* + * Configuration is pending restart or not. + */ + @JsonProperty(value = "isConfigPendingRestart", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isConfigPendingRestart; + + /* + * Configuration unit. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /* + * Configuration documentation link. + */ + @JsonProperty(value = "documentationLink", access = JsonProperty.Access.WRITE_ONLY) + private String documentationLink; + + /** Creates an instance of ConfigurationProperties class. */ + public ConfigurationProperties() { + } + + /** + * Get the value property: Value of the configuration. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Value of the configuration. + * + * @param value the value value to set. + * @return the ConfigurationProperties object itself. + */ + public ConfigurationProperties withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the description property: Description of the configuration. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the defaultValue property: Default value of the configuration. + * + * @return the defaultValue value. + */ + public String defaultValue() { + return this.defaultValue; + } + + /** + * Get the dataType property: Data type of the configuration. + * + * @return the dataType value. + */ + public ConfigurationDataType dataType() { + return this.dataType; + } + + /** + * Get the allowedValues property: Allowed values of the configuration. + * + * @return the allowedValues value. + */ + public String allowedValues() { + return this.allowedValues; + } + + /** + * Get the source property: Source of the configuration. + * + * @return the source value. + */ + public String source() { + return this.source; + } + + /** + * Set the source property: Source of the configuration. + * + * @param source the source value to set. + * @return the ConfigurationProperties object itself. + */ + public ConfigurationProperties withSource(String source) { + this.source = source; + return this; + } + + /** + * Get the isDynamicConfig property: Configuration dynamic or static. + * + * @return the isDynamicConfig value. + */ + public Boolean isDynamicConfig() { + return this.isDynamicConfig; + } + + /** + * Get the isReadOnly property: Configuration read-only or not. + * + * @return the isReadOnly value. + */ + public Boolean isReadOnly() { + return this.isReadOnly; + } + + /** + * Get the isConfigPendingRestart property: Configuration is pending restart or not. + * + * @return the isConfigPendingRestart value. + */ + public Boolean isConfigPendingRestart() { + return this.isConfigPendingRestart; + } + + /** + * Get the unit property: Configuration unit. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the documentationLink property: Configuration documentation link. + * + * @return the documentationLink value. + */ + public String documentationLink() { + return this.documentationLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/DatabaseInner.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/DatabaseInner.java new file mode 100644 index 000000000000..c352f43a40d7 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/DatabaseInner.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a Database. */ +@Fluent +public final class DatabaseInner extends ProxyResource { + /* + * The properties of a database. + */ + @JsonProperty(value = "properties") + private DatabaseProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of DatabaseInner class. */ + public DatabaseInner() { + } + + /** + * Get the innerProperties property: The properties of a database. + * + * @return the innerProperties value. + */ + private DatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the charset property: The charset of the database. + * + * @return the charset value. + */ + public String charset() { + return this.innerProperties() == null ? null : this.innerProperties().charset(); + } + + /** + * Set the charset property: The charset of the database. + * + * @param charset the charset value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCharset(String charset) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withCharset(charset); + return this; + } + + /** + * Get the collation property: The collation of the database. + * + * @return the collation value. + */ + public String collation() { + return this.innerProperties() == null ? null : this.innerProperties().collation(); + } + + /** + * Set the collation property: The collation of the database. + * + * @param collation the collation value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCollation(String collation) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withCollation(collation); + 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/DatabaseProperties.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/DatabaseProperties.java new file mode 100644 index 000000000000..491190630dfb --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/DatabaseProperties.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a database. */ +@Fluent +public final class DatabaseProperties { + /* + * The charset of the database. + */ + @JsonProperty(value = "charset") + private String charset; + + /* + * The collation of the database. + */ + @JsonProperty(value = "collation") + private String collation; + + /** Creates an instance of DatabaseProperties class. */ + public DatabaseProperties() { + } + + /** + * Get the charset property: The charset of the database. + * + * @return the charset value. + */ + public String charset() { + return this.charset; + } + + /** + * Set the charset property: The charset of the database. + * + * @param charset the charset value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withCharset(String charset) { + this.charset = charset; + return this; + } + + /** + * Get the collation property: The collation of the database. + * + * @return the collation value. + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation property: The collation of the database. + * + * @param collation the collation value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/FirewallRuleInner.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/FirewallRuleInner.java new file mode 100644 index 000000000000..b8dff329c012 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/FirewallRuleInner.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a server firewall rule. */ +@Fluent +public final class FirewallRuleInner extends ProxyResource { + /* + * The properties of a firewall rule. + */ + @JsonProperty(value = "properties", required = true) + private FirewallRuleProperties innerProperties = new FirewallRuleProperties(); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @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. + * + * @return the innerProperties value. + */ + private FirewallRuleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 format. + * + * @return the startIpAddress value. + */ + public String startIpAddress() { + return this.innerProperties() == null ? null : this.innerProperties().startIpAddress(); + } + + /** + * Set the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 format. + * + * @param startIpAddress the startIpAddress value to set. + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withStartIpAddress(String startIpAddress) { + if (this.innerProperties() == null) { + this.innerProperties = new FirewallRuleProperties(); + } + this.innerProperties().withStartIpAddress(startIpAddress); + return this; + } + + /** + * Get the endIpAddress property: The end IP address of the server firewall rule. Must be IPv4 format. + * + * @return the endIpAddress value. + */ + public String endIpAddress() { + return this.innerProperties() == null ? null : this.innerProperties().endIpAddress(); + } + + /** + * Set the endIpAddress property: The end IP address of the server firewall rule. Must be IPv4 format. + * + * @param endIpAddress the endIpAddress value to set. + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withEndIpAddress(String endIpAddress) { + if (this.innerProperties() == null) { + this.innerProperties = new FirewallRuleProperties(); + } + this.innerProperties().withEndIpAddress(endIpAddress); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model FirewallRuleInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FirewallRuleInner.class); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/FirewallRuleProperties.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/FirewallRuleProperties.java new file mode 100644 index 000000000000..1ff3c9e53615 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/FirewallRuleProperties.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a server firewall rule. */ +@Fluent +public final class FirewallRuleProperties { + /* + * The start IP address of the server firewall rule. Must be IPv4 format. + */ + @JsonProperty(value = "startIpAddress", required = true) + private String startIpAddress; + + /* + * The end IP address of the server firewall rule. Must be IPv4 format. + */ + @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. + * + * @return the startIpAddress value. + */ + public String startIpAddress() { + return this.startIpAddress; + } + + /** + * Set the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 format. + * + * @param startIpAddress the startIpAddress value to set. + * @return the FirewallRuleProperties object itself. + */ + public FirewallRuleProperties withStartIpAddress(String startIpAddress) { + this.startIpAddress = startIpAddress; + return this; + } + + /** + * Get the endIpAddress property: The end IP address of the server firewall rule. Must be IPv4 format. + * + * @return the endIpAddress value. + */ + public String endIpAddress() { + return this.endIpAddress; + } + + /** + * Set the endIpAddress property: The end IP address of the server firewall rule. Must be IPv4 format. + * + * @param endIpAddress the endIpAddress value to set. + * @return the FirewallRuleProperties object itself. + */ + public FirewallRuleProperties withEndIpAddress(String endIpAddress) { + this.endIpAddress = endIpAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (startIpAddress() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property startIpAddress in model FirewallRuleProperties")); + } + if (endIpAddress() == null) { + 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/NameAvailabilityInner.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/NameAvailabilityInner.java new file mode 100644 index 000000000000..908d5beae915 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/NameAvailabilityInner.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilityReason; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilityResponse; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a resource name availability. */ +@Fluent +public final class NameAvailabilityInner extends CheckNameAvailabilityResponse { + /* + * name of the PostgreSQL server. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * type of the server + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** Creates an instance of NameAvailabilityInner class. */ + public NameAvailabilityInner() { + } + + /** + * Get the name property: name of the PostgreSQL server. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: type of the server. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** {@inheritDoc} */ + @Override + public NameAvailabilityInner withNameAvailable(Boolean nameAvailable) { + super.withNameAvailable(nameAvailable); + return this; + } + + /** {@inheritDoc} */ + @Override + public NameAvailabilityInner withReason(CheckNameAvailabilityReason reason) { + super.withReason(reason); + return this; + } + + /** {@inheritDoc} */ + @Override + public NameAvailabilityInner withMessage(String message) { + super.withMessage(message); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/OperationListResultInner.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/OperationListResultInner.java new file mode 100644 index 000000000000..113ae2bb8b73 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/OperationListResultInner.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Operation; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of resource provider operations. */ +@Fluent +public final class OperationListResultInner { + /* + * Collection of available operation details + */ + @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. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Collection of available operation details. + * + * @param value the value value to set. + * @return the OperationListResultInner object itself. + */ + public OperationListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL client should use to fetch the next page (per server side paging). 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. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ServerBackupInner.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ServerBackupInner.java new file mode 100644 index 000000000000..a082464704e3 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ServerBackupInner.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Server backup properties. */ +@Fluent +public final class ServerBackupInner extends ProxyResource { + /* + * The properties of a server backup. + */ + @JsonProperty(value = "properties") + private ServerBackupProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of ServerBackupInner class. */ + public ServerBackupInner() { + } + + /** + * Get the innerProperties property: The properties of a server backup. + * + * @return the innerProperties value. + */ + private ServerBackupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the backupType property: Backup type. + * + * @return the backupType value. + */ + public Origin backupType() { + return this.innerProperties() == null ? null : this.innerProperties().backupType(); + } + + /** + * Set the backupType property: Backup type. + * + * @param backupType the backupType value to set. + * @return the ServerBackupInner object itself. + */ + public ServerBackupInner withBackupType(Origin backupType) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBackupProperties(); + } + this.innerProperties().withBackupType(backupType); + return this; + } + + /** + * Get the completedTime property: Backup completed time (ISO8601 format). + * + * @return the completedTime value. + */ + public OffsetDateTime completedTime() { + return this.innerProperties() == null ? null : this.innerProperties().completedTime(); + } + + /** + * Set the completedTime property: Backup completed time (ISO8601 format). + * + * @param completedTime the completedTime value to set. + * @return the ServerBackupInner object itself. + */ + public ServerBackupInner withCompletedTime(OffsetDateTime completedTime) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBackupProperties(); + } + this.innerProperties().withCompletedTime(completedTime); + return this; + } + + /** + * Get the source property: Backup source. + * + * @return the source value. + */ + public String source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Set the source property: Backup source. + * + * @param source the source value to set. + * @return the ServerBackupInner object itself. + */ + public ServerBackupInner withSource(String source) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBackupProperties(); + } + this.innerProperties().withSource(source); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ServerBackupProperties.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ServerBackupProperties.java new file mode 100644 index 000000000000..f2a28cf11f77 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ServerBackupProperties.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a server backup. */ +@Fluent +public final class ServerBackupProperties { + /* + * Backup type. + */ + @JsonProperty(value = "backupType") + private Origin backupType; + + /* + * Backup completed time (ISO8601 format). + */ + @JsonProperty(value = "completedTime") + private OffsetDateTime completedTime; + + /* + * Backup source + */ + @JsonProperty(value = "source") + private String source; + + /** Creates an instance of ServerBackupProperties class. */ + public ServerBackupProperties() { + } + + /** + * Get the backupType property: Backup type. + * + * @return the backupType value. + */ + public Origin backupType() { + return this.backupType; + } + + /** + * Set the backupType property: Backup type. + * + * @param backupType the backupType value to set. + * @return the ServerBackupProperties object itself. + */ + public ServerBackupProperties withBackupType(Origin backupType) { + this.backupType = backupType; + return this; + } + + /** + * Get the completedTime property: Backup completed time (ISO8601 format). + * + * @return the completedTime value. + */ + public OffsetDateTime completedTime() { + return this.completedTime; + } + + /** + * Set the completedTime property: Backup completed time (ISO8601 format). + * + * @param completedTime the completedTime value to set. + * @return the ServerBackupProperties object itself. + */ + public ServerBackupProperties withCompletedTime(OffsetDateTime completedTime) { + this.completedTime = completedTime; + return this; + } + + /** + * Get the source property: Backup source. + * + * @return the source value. + */ + public String source() { + return this.source; + } + + /** + * Set the source property: Backup source. + * + * @param source the source value to set. + * @return the ServerBackupProperties object itself. + */ + public ServerBackupProperties withSource(String source) { + this.source = source; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ServerInner.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ServerInner.java new file mode 100644 index 000000000000..6cf80edcb972 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ServerInner.java @@ -0,0 +1,537 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.AuthConfig; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Backup; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CreateMode; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.DataEncryption; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.HighAvailability; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Network; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ReplicationRole; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerState; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerVersion; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Sku; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Storage; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.UserAssignedIdentity; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** Represents a server. */ +@Fluent +public final class ServerInner extends Resource { + /* + * The SKU (pricing tier) of the server. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Describes the identity of the application. + */ + @JsonProperty(value = "identity") + private UserAssignedIdentity identity; + + /* + * Properties of the server. + */ + @JsonProperty(value = "properties") + private ServerProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of ServerInner class. */ + public ServerInner() { + } + + /** + * 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 ServerInner object itself. + */ + public ServerInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the identity property: Describes the identity of the application. + * + * @return the identity value. + */ + public UserAssignedIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Describes the identity of the application. + * + * @param identity the identity value to set. + * @return the ServerInner object itself. + */ + public ServerInner withIdentity(UserAssignedIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the innerProperties property: Properties of the server. + * + * @return the innerProperties value. + */ + private ServerProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public ServerInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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 ServerInner object itself. + */ + public ServerInner withAdministratorLogin(String administratorLogin) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withAdministratorLogin(administratorLogin); + return this; + } + + /** + * Get the administratorLoginPassword property: The administrator login password (required for server creation). + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.innerProperties() == null ? null : this.innerProperties().administratorLoginPassword(); + } + + /** + * Set the administratorLoginPassword property: The administrator login password (required for server creation). + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ServerInner object itself. + */ + public ServerInner withAdministratorLoginPassword(String administratorLoginPassword) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + /** + * Get the version property: PostgreSQL Server version. + * + * @return the version value. + */ + public ServerVersion version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: PostgreSQL Server version. + * + * @param version the version value to set. + * @return the ServerInner object itself. + */ + public ServerInner withVersion(ServerVersion version) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the minorVersion property: The minor version of the server. + * + * @return the minorVersion value. + */ + public String minorVersion() { + return this.innerProperties() == null ? null : this.innerProperties().minorVersion(); + } + + /** + * Get the state property: A state of a server that is visible to user. + * + * @return the state value. + */ + public ServerState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.innerProperties() == null ? null : this.innerProperties().fullyQualifiedDomainName(); + } + + /** + * 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 ServerInner object itself. + */ + public ServerInner withStorage(Storage storage) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withStorage(storage); + return this; + } + + /** + * Get the authConfig property: AuthConfig properties of a server. + * + * @return the authConfig value. + */ + public AuthConfig authConfig() { + return this.innerProperties() == null ? null : this.innerProperties().authConfig(); + } + + /** + * Set the authConfig property: AuthConfig properties of a server. + * + * @param authConfig the authConfig value to set. + * @return the ServerInner object itself. + */ + public ServerInner withAuthConfig(AuthConfig authConfig) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withAuthConfig(authConfig); + return this; + } + + /** + * Get the dataEncryption property: Data encryption properties of a server. + * + * @return the dataEncryption value. + */ + public DataEncryption dataEncryption() { + return this.innerProperties() == null ? null : this.innerProperties().dataEncryption(); + } + + /** + * Set the dataEncryption property: Data encryption properties of a server. + * + * @param dataEncryption the dataEncryption value to set. + * @return the ServerInner object itself. + */ + public ServerInner withDataEncryption(DataEncryption dataEncryption) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withDataEncryption(dataEncryption); + 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 ServerInner object itself. + */ + public ServerInner withBackup(Backup backup) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withBackup(backup); + return this; + } + + /** + * Get the network property: Network properties of a server. This Network property is required to be passed only in + * case you want the server to be Private access server. + * + * @return the network value. + */ + public Network network() { + return this.innerProperties() == null ? null : this.innerProperties().network(); + } + + /** + * Set the network property: Network properties of a server. This Network property is required to be passed only in + * case you want the server to be Private access server. + * + * @param network the network value to set. + * @return the ServerInner object itself. + */ + public ServerInner withNetwork(Network network) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withNetwork(network); + 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 ServerInner object itself. + */ + public ServerInner withHighAvailability(HighAvailability highAvailability) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + 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 ServerInner object itself. + */ + public ServerInner withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withMaintenanceWindow(maintenanceWindow); + return this; + } + + /** + * Get the sourceServerResourceId property: The source server resource ID to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'. This property is returned only for Replica + * server. + * + * @return the sourceServerResourceId value. + */ + public String sourceServerResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceServerResourceId(); + } + + /** + * Set the sourceServerResourceId property: The source server resource ID to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'. This property is returned only for Replica + * server. + * + * @param sourceServerResourceId the sourceServerResourceId value to set. + * @return the ServerInner object itself. + */ + public ServerInner withSourceServerResourceId(String sourceServerResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withSourceServerResourceId(sourceServerResourceId); + 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' or 'GeoRestore'. + * + * @return the pointInTimeUtc value. + */ + public OffsetDateTime pointInTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().pointInTimeUtc(); + } + + /** + * Set the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore + * from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore'. + * + * @param pointInTimeUtc the pointInTimeUtc value to set. + * @return the ServerInner object itself. + */ + public ServerInner withPointInTimeUtc(OffsetDateTime pointInTimeUtc) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withPointInTimeUtc(pointInTimeUtc); + return this; + } + + /** + * Get the availabilityZone property: availability zone information of the server. + * + * @return the availabilityZone value. + */ + public String availabilityZone() { + return this.innerProperties() == null ? null : this.innerProperties().availabilityZone(); + } + + /** + * Set the availabilityZone property: availability zone information of the server. + * + * @param availabilityZone the availabilityZone value to set. + * @return the ServerInner object itself. + */ + public ServerInner withAvailabilityZone(String availabilityZone) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withAvailabilityZone(availabilityZone); + return this; + } + + /** + * Get the replicationRole property: Replication role of the server. + * + * @return the replicationRole value. + */ + public ReplicationRole replicationRole() { + return this.innerProperties() == null ? null : this.innerProperties().replicationRole(); + } + + /** + * Set the replicationRole property: Replication role of the server. + * + * @param replicationRole the replicationRole value to set. + * @return the ServerInner object itself. + */ + public ServerInner withReplicationRole(ReplicationRole replicationRole) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withReplicationRole(replicationRole); + return this; + } + + /** + * Get the replicaCapacity property: Replicas allowed for a server. + * + * @return the replicaCapacity value. + */ + public Integer replicaCapacity() { + return this.innerProperties() == null ? null : this.innerProperties().replicaCapacity(); + } + + /** + * Get the createMode property: The mode to create a new PostgreSQL server. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.innerProperties() == null ? null : this.innerProperties().createMode(); + } + + /** + * Set the createMode property: The mode to create a new PostgreSQL server. + * + * @param createMode the createMode value to set. + * @return the ServerInner object itself. + */ + public ServerInner withCreateMode(CreateMode createMode) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + 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 (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ServerProperties.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ServerProperties.java new file mode 100644 index 000000000000..92220a70494d --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ServerProperties.java @@ -0,0 +1,521 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.AuthConfig; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Backup; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CreateMode; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.DataEncryption; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.HighAvailability; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Network; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ReplicationRole; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerState; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerVersion; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Storage; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a server. */ +@Fluent +public final class ServerProperties { + /* + * 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. + */ + @JsonProperty(value = "version") + private ServerVersion version; + + /* + * The minor version of the server. + */ + @JsonProperty(value = "minorVersion", access = JsonProperty.Access.WRITE_ONLY) + private String minorVersion; + + /* + * A state of a server that is visible to user. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private ServerState state; + + /* + * The fully qualified domain name of a server. + */ + @JsonProperty(value = "fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /* + * Storage properties of a server. + */ + @JsonProperty(value = "storage") + private Storage storage; + + /* + * AuthConfig properties of a server. + */ + @JsonProperty(value = "authConfig") + private AuthConfig authConfig; + + /* + * Data encryption properties of a server. + */ + @JsonProperty(value = "dataEncryption") + private DataEncryption dataEncryption; + + /* + * Backup properties of a server. + */ + @JsonProperty(value = "backup") + private Backup backup; + + /* + * Network properties of a server. This Network property is required to be passed only in case you want the server + * to be Private access server. + */ + @JsonProperty(value = "network") + private Network network; + + /* + * 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 source server resource ID to restore from. It's required when 'createMode' is 'PointInTimeRestore' or + * 'GeoRestore' or 'Replica'. This property is returned only for Replica server + */ + @JsonProperty(value = "sourceServerResourceId") + private String sourceServerResourceId; + + /* + * Restore point creation time (ISO8601 format), specifying the time to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'GeoRestore'. + */ + @JsonProperty(value = "pointInTimeUTC") + private OffsetDateTime pointInTimeUtc; + + /* + * availability zone information of the server. + */ + @JsonProperty(value = "availabilityZone") + private String availabilityZone; + + /* + * Replication role of the server + */ + @JsonProperty(value = "replicationRole") + private ReplicationRole replicationRole; + + /* + * Replicas allowed for a server. + */ + @JsonProperty(value = "replicaCapacity", access = JsonProperty.Access.WRITE_ONLY) + private Integer replicaCapacity; + + /* + * The mode to create a new PostgreSQL server. + */ + @JsonProperty(value = "createMode") + private CreateMode createMode; + + /** 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 + * 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 ServerProperties object itself. + */ + public ServerProperties withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: The administrator login password (required for server creation). + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The administrator login password (required for server creation). + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the version property: PostgreSQL Server version. + * + * @return the version value. + */ + public ServerVersion version() { + return this.version; + } + + /** + * Set the version property: PostgreSQL Server version. + * + * @param version the version value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withVersion(ServerVersion version) { + this.version = version; + return this; + } + + /** + * Get the minorVersion property: The minor version of the server. + * + * @return the minorVersion value. + */ + public String minorVersion() { + return this.minorVersion; + } + + /** + * Get the state property: A state of a server that is visible to user. + * + * @return the state value. + */ + public ServerState state() { + return this.state; + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * 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 ServerProperties object itself. + */ + public ServerProperties withStorage(Storage storage) { + this.storage = storage; + return this; + } + + /** + * Get the authConfig property: AuthConfig properties of a server. + * + * @return the authConfig value. + */ + public AuthConfig authConfig() { + return this.authConfig; + } + + /** + * Set the authConfig property: AuthConfig properties of a server. + * + * @param authConfig the authConfig value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withAuthConfig(AuthConfig authConfig) { + this.authConfig = authConfig; + return this; + } + + /** + * Get the dataEncryption property: Data encryption properties of a server. + * + * @return the dataEncryption value. + */ + public DataEncryption dataEncryption() { + return this.dataEncryption; + } + + /** + * Set the dataEncryption property: Data encryption properties of a server. + * + * @param dataEncryption the dataEncryption value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withDataEncryption(DataEncryption dataEncryption) { + this.dataEncryption = dataEncryption; + 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 ServerProperties object itself. + */ + public ServerProperties withBackup(Backup backup) { + this.backup = backup; + return this; + } + + /** + * Get the network property: Network properties of a server. This Network property is required to be passed only in + * case you want the server to be Private access server. + * + * @return the network value. + */ + public Network network() { + return this.network; + } + + /** + * Set the network property: Network properties of a server. This Network property is required to be passed only in + * case you want the server to be Private access server. + * + * @param network the network value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withNetwork(Network network) { + this.network = network; + 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 ServerProperties object itself. + */ + public ServerProperties 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 ServerProperties object itself. + */ + public ServerProperties withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + this.maintenanceWindow = maintenanceWindow; + return this; + } + + /** + * Get the sourceServerResourceId property: The source server resource ID to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'. This property is returned only for Replica + * server. + * + * @return the sourceServerResourceId value. + */ + public String sourceServerResourceId() { + return this.sourceServerResourceId; + } + + /** + * Set the sourceServerResourceId property: The source server resource ID to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'. This property is returned only for Replica + * server. + * + * @param sourceServerResourceId the sourceServerResourceId value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withSourceServerResourceId(String sourceServerResourceId) { + this.sourceServerResourceId = sourceServerResourceId; + 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' or 'GeoRestore'. + * + * @return the pointInTimeUtc value. + */ + public OffsetDateTime pointInTimeUtc() { + return this.pointInTimeUtc; + } + + /** + * Set the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore + * from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore'. + * + * @param pointInTimeUtc the pointInTimeUtc value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withPointInTimeUtc(OffsetDateTime pointInTimeUtc) { + this.pointInTimeUtc = pointInTimeUtc; + return this; + } + + /** + * Get the availabilityZone property: availability zone information of the server. + * + * @return the availabilityZone value. + */ + public String availabilityZone() { + return this.availabilityZone; + } + + /** + * Set the availabilityZone property: availability zone information of the server. + * + * @param availabilityZone the availabilityZone value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withAvailabilityZone(String availabilityZone) { + this.availabilityZone = availabilityZone; + return this; + } + + /** + * Get the replicationRole property: Replication role of the server. + * + * @return the replicationRole value. + */ + public ReplicationRole replicationRole() { + return this.replicationRole; + } + + /** + * Set the replicationRole property: Replication role of the server. + * + * @param replicationRole the replicationRole value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withReplicationRole(ReplicationRole replicationRole) { + this.replicationRole = replicationRole; + return this; + } + + /** + * Get the replicaCapacity property: Replicas allowed for a server. + * + * @return the replicaCapacity value. + */ + public Integer replicaCapacity() { + return this.replicaCapacity; + } + + /** + * Get the createMode property: The mode to create a new PostgreSQL server. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: The mode to create a new PostgreSQL server. + * + * @param createMode the createMode value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withCreateMode(CreateMode 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 (authConfig() != null) { + authConfig().validate(); + } + if (dataEncryption() != null) { + dataEncryption().validate(); + } + if (backup() != null) { + backup().validate(); + } + if (network() != null) { + network().validate(); + } + if (highAvailability() != null) { + highAvailability().validate(); + } + if (maintenanceWindow() != null) { + maintenanceWindow().validate(); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ServerPropertiesForUpdate.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ServerPropertiesForUpdate.java new file mode 100644 index 000000000000..8eb84c103f5a --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/ServerPropertiesForUpdate.java @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.AuthConfig; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Backup; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CreateModeForUpdate; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.DataEncryption; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.HighAvailability; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Network; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ReplicationRole; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerVersion; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Storage; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ServerPropertiesForUpdate model. */ +@Fluent +public final class ServerPropertiesForUpdate { + /* + * The password of the administrator login. + */ + @JsonProperty(value = "administratorLoginPassword") + private String administratorLoginPassword; + + /* + * PostgreSQL Server version. + */ + @JsonProperty(value = "version") + private ServerVersion version; + + /* + * 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; + + /* + * AuthConfig properties of a server. + */ + @JsonProperty(value = "authConfig") + private AuthConfig authConfig; + + /* + * Data encryption properties of a server. + */ + @JsonProperty(value = "dataEncryption") + private DataEncryption dataEncryption; + + /* + * The mode to update a new PostgreSQL server. + */ + @JsonProperty(value = "createMode") + private CreateModeForUpdate createMode; + + /* + * Replication role of the server + */ + @JsonProperty(value = "replicationRole") + private ReplicationRole replicationRole; + + /* + * Network properties of a server. These are required to be passed only in case if server is a private access + * server. + */ + @JsonProperty(value = "network") + private Network network; + + /** Creates an instance of ServerPropertiesForUpdate class. */ + public ServerPropertiesForUpdate() { + } + + /** + * 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 version property: PostgreSQL Server version. + * + * @return the version value. + */ + public ServerVersion version() { + return this.version; + } + + /** + * Set the version property: PostgreSQL Server version. + * + * @param version the version value to set. + * @return the ServerPropertiesForUpdate object itself. + */ + public ServerPropertiesForUpdate withVersion(ServerVersion version) { + this.version = version; + 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 authConfig property: AuthConfig properties of a server. + * + * @return the authConfig value. + */ + public AuthConfig authConfig() { + return this.authConfig; + } + + /** + * Set the authConfig property: AuthConfig properties of a server. + * + * @param authConfig the authConfig value to set. + * @return the ServerPropertiesForUpdate object itself. + */ + public ServerPropertiesForUpdate withAuthConfig(AuthConfig authConfig) { + this.authConfig = authConfig; + return this; + } + + /** + * Get the dataEncryption property: Data encryption properties of a server. + * + * @return the dataEncryption value. + */ + public DataEncryption dataEncryption() { + return this.dataEncryption; + } + + /** + * Set the dataEncryption property: Data encryption properties of a server. + * + * @param dataEncryption the dataEncryption value to set. + * @return the ServerPropertiesForUpdate object itself. + */ + public ServerPropertiesForUpdate withDataEncryption(DataEncryption dataEncryption) { + this.dataEncryption = dataEncryption; + 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; + } + + /** + * Get the replicationRole property: Replication role of the server. + * + * @return the replicationRole value. + */ + public ReplicationRole replicationRole() { + return this.replicationRole; + } + + /** + * Set the replicationRole property: Replication role of the server. + * + * @param replicationRole the replicationRole value to set. + * @return the ServerPropertiesForUpdate object itself. + */ + public ServerPropertiesForUpdate withReplicationRole(ReplicationRole replicationRole) { + this.replicationRole = replicationRole; + return this; + } + + /** + * Get the network property: Network properties of a server. These are required to be passed only in case if server + * is a private access server. + * + * @return the network value. + */ + public Network network() { + return this.network; + } + + /** + * Set the network property: Network properties of a server. These are required to be passed only in case if server + * is a private access server. + * + * @param network the network value to set. + * @return the ServerPropertiesForUpdate object itself. + */ + public ServerPropertiesForUpdate withNetwork(Network network) { + this.network = network; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storage() != null) { + storage().validate(); + } + if (backup() != null) { + backup().validate(); + } + if (highAvailability() != null) { + highAvailability().validate(); + } + if (maintenanceWindow() != null) { + maintenanceWindow().validate(); + } + if (authConfig() != null) { + authConfig().validate(); + } + if (dataEncryption() != null) { + dataEncryption().validate(); + } + if (network() != null) { + network().validate(); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/VirtualNetworkSubnetUsageResultInner.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/VirtualNetworkSubnetUsageResultInner.java new file mode 100644 index 000000000000..711294526205 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/VirtualNetworkSubnetUsageResultInner.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.DelegatedSubnetUsage; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Virtual network subnet usage data. */ +@Immutable +public final class VirtualNetworkSubnetUsageResultInner { + /* + * The delegatedSubnetsUsage property. + */ + @JsonProperty(value = "delegatedSubnetsUsage", access = JsonProperty.Access.WRITE_ONLY) + private List delegatedSubnetsUsage; + + /* + * location of the delegated subnet usage + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * subscriptionId of the delegated subnet usage + */ + @JsonProperty(value = "subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /** Creates an instance of VirtualNetworkSubnetUsageResultInner class. */ + public VirtualNetworkSubnetUsageResultInner() { + } + + /** + * Get the delegatedSubnetsUsage property: The delegatedSubnetsUsage property. + * + * @return the delegatedSubnetsUsage value. + */ + public List delegatedSubnetsUsage() { + return this.delegatedSubnetsUsage; + } + + /** + * Get the location property: location of the delegated subnet usage. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the subscriptionId property: subscriptionId of the delegated subnet usage. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/package-info.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/package-info.java new file mode 100644 index 000000000000..c29098d38b47 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for PostgreSqlManagementClient. 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 com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/package-info.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/package-info.java new file mode 100644 index 000000000000..818e13f97e5f --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/fluent/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for PostgreSqlManagementClient. 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 com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent; diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ActiveDirectoryAdministratorImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ActiveDirectoryAdministratorImpl.java new file mode 100644 index 000000000000..3f3a436c5cd2 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ActiveDirectoryAdministratorImpl.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ActiveDirectoryAdministratorInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ActiveDirectoryAdministrator; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ActiveDirectoryAdministratorAdd; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.PrincipalType; + +public final class ActiveDirectoryAdministratorImpl + implements ActiveDirectoryAdministrator, ActiveDirectoryAdministrator.Definition { + private ActiveDirectoryAdministratorInner innerObject; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + ActiveDirectoryAdministratorImpl( + ActiveDirectoryAdministratorInner innerObject, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public PrincipalType principalType() { + return this.innerModel().principalType(); + } + + public String principalName() { + return this.innerModel().principalName(); + } + + public String objectId() { + return this.innerModel().objectId(); + } + + public String tenantId() { + return this.innerModel().tenantId(); + } + + public ActiveDirectoryAdministratorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String objectId; + + private ActiveDirectoryAdministratorAdd createParameters; + + public ActiveDirectoryAdministratorImpl withExistingFlexibleServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ActiveDirectoryAdministrator create() { + this.innerObject = + serviceManager + .serviceClient() + .getAdministrators() + .create(resourceGroupName, serverName, objectId, createParameters, Context.NONE); + return this; + } + + public ActiveDirectoryAdministrator create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAdministrators() + .create(resourceGroupName, serverName, objectId, createParameters, context); + return this; + } + + ActiveDirectoryAdministratorImpl( + String name, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerObject = new ActiveDirectoryAdministratorInner(); + this.serviceManager = serviceManager; + this.objectId = name; + this.createParameters = new ActiveDirectoryAdministratorAdd(); + } + + public ActiveDirectoryAdministrator refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAdministrators() + .getWithResponse(resourceGroupName, serverName, objectId, Context.NONE) + .getValue(); + return this; + } + + public ActiveDirectoryAdministrator refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAdministrators() + .getWithResponse(resourceGroupName, serverName, objectId, context) + .getValue(); + return this; + } + + public ActiveDirectoryAdministratorImpl withPrincipalType(PrincipalType principalType) { + this.createParameters.withPrincipalType(principalType); + return this; + } + + public ActiveDirectoryAdministratorImpl withPrincipalName(String principalName) { + this.createParameters.withPrincipalName(principalName); + return this; + } + + public ActiveDirectoryAdministratorImpl withTenantId(String tenantId) { + this.createParameters.withTenantId(tenantId); + return this; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/AdministratorsClientImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/AdministratorsClientImpl.java new file mode 100644 index 000000000000..087d0c292eec --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/AdministratorsClientImpl.java @@ -0,0 +1,1116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.AdministratorsClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ActiveDirectoryAdministratorInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ActiveDirectoryAdministratorAdd; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.AdministratorListResult; +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 AdministratorsClient. */ +public final class AdministratorsClientImpl implements AdministratorsClient { + /** The proxy service used to perform REST calls. */ + private final AdministratorsService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of AdministratorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AdministratorsClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(AdministratorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientAdministrators to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface AdministratorsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("objectId") String objectId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ActiveDirectoryAdministratorAdd parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}") + @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, + @PathParam("objectId") String objectId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("objectId") String objectId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for 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 represents an Active Directory administrator along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, String objectId, ActiveDirectoryAdministratorAdd 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 (objectId == null) { + return Mono.error(new IllegalArgumentException("Parameter objectId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + objectId, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for 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 represents an Active Directory administrator along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String serverName, + String objectId, + ActiveDirectoryAdministratorAdd 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 (objectId == null) { + return Mono.error(new IllegalArgumentException("Parameter objectId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + objectId, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents an Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, ActiveDirectoryAdministratorInner> + beginCreateAsync( + String resourceGroupName, String serverName, String objectId, ActiveDirectoryAdministratorAdd parameters) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverName, objectId, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ActiveDirectoryAdministratorInner.class, + ActiveDirectoryAdministratorInner.class, + this.client.getContext()); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for 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 {@link PollerFlux} for polling of represents an Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ActiveDirectoryAdministratorInner> + beginCreateAsync( + String resourceGroupName, + String serverName, + String objectId, + ActiveDirectoryAdministratorAdd parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverName, objectId, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ActiveDirectoryAdministratorInner.class, + ActiveDirectoryAdministratorInner.class, + context); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents an Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ActiveDirectoryAdministratorInner> beginCreate( + String resourceGroupName, String serverName, String objectId, ActiveDirectoryAdministratorAdd parameters) { + return this.beginCreateAsync(resourceGroupName, serverName, objectId, parameters).getSyncPoller(); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for 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 {@link SyncPoller} for polling of represents an Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ActiveDirectoryAdministratorInner> beginCreate( + String resourceGroupName, + String serverName, + String objectId, + ActiveDirectoryAdministratorAdd parameters, + Context context) { + return this.beginCreateAsync(resourceGroupName, serverName, objectId, parameters, context).getSyncPoller(); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for 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 represents an Active Directory administrator on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync( + String resourceGroupName, String serverName, String objectId, ActiveDirectoryAdministratorAdd parameters) { + return beginCreateAsync(resourceGroupName, serverName, objectId, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for 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 represents an Active Directory administrator on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String serverName, + String objectId, + ActiveDirectoryAdministratorAdd parameters, + Context context) { + return beginCreateAsync(resourceGroupName, serverName, objectId, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for 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 represents an Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActiveDirectoryAdministratorInner create( + String resourceGroupName, String serverName, String objectId, ActiveDirectoryAdministratorAdd parameters) { + return createAsync(resourceGroupName, serverName, objectId, parameters).block(); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the administrator. + * @param parameters The required parameters for adding an active directory administrator for 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 represents an Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActiveDirectoryAdministratorInner create( + String resourceGroupName, + String serverName, + String objectId, + ActiveDirectoryAdministratorAdd parameters, + Context context) { + return createAsync(resourceGroupName, serverName, objectId, parameters, context).block(); + } + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String objectId) { + 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 (objectId == null) { + return Mono.error(new IllegalArgumentException("Parameter objectId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + objectId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String objectId, 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 (objectId == null) { + return Mono.error(new IllegalArgumentException("Parameter objectId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + objectId, + accept, + context); + } + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String objectId) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, objectId); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String objectId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, objectId, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String objectId) { + return this.beginDeleteAsync(resourceGroupName, serverName, objectId).getSyncPoller(); + } + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String objectId, Context context) { + return this.beginDeleteAsync(resourceGroupName, serverName, objectId, context).getSyncPoller(); + } + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String serverName, String objectId) { + return beginDeleteAsync(resourceGroupName, serverName, objectId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String objectId, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, objectId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String objectId) { + deleteAsync(resourceGroupName, serverName, objectId).block(); + } + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String objectId, Context context) { + deleteAsync(resourceGroupName, serverName, objectId, context).block(); + } + + /** + * 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 objectId Guid of the objectId for the 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 information about a server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String objectId) { + 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 (objectId == null) { + return Mono.error(new IllegalArgumentException("Parameter objectId 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, + objectId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 objectId Guid of the objectId for the 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 information about a server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String objectId, 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 (objectId == null) { + return Mono.error(new IllegalArgumentException("Parameter objectId 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, + objectId, + accept, + 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 objectId Guid of the objectId for the 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 information about a server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync( + String resourceGroupName, String serverName, String objectId) { + return getWithResponseAsync(resourceGroupName, serverName, objectId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 objectId Guid of the objectId for the 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 information about a server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String objectId, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, objectId, context).block(); + } + + /** + * 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 objectId Guid of the objectId for the 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 information about a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActiveDirectoryAdministratorInner get(String resourceGroupName, String serverName, String objectId) { + return getWithResponse(resourceGroupName, serverName, objectId, Context.NONE).getValue(); + } + + /** + * List all the AAD administrators 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 active directory administrators along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the AAD administrators 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 active directory administrators along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the AAD administrators 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 active directory administrators as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * List all the AAD administrators 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 active directory administrators as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the AAD administrators 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 active directory administrators 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 AAD administrators 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 active directory administrators 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 active directory administrators 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 active directory administrators 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/AdministratorsImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/AdministratorsImpl.java new file mode 100644 index 000000000000..f9929014762a --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/AdministratorsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.AdministratorsClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ActiveDirectoryAdministratorInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ActiveDirectoryAdministrator; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Administrators; + +public final class AdministratorsImpl implements Administrators { + private static final ClientLogger LOGGER = new ClientLogger(AdministratorsImpl.class); + + private final AdministratorsClient innerClient; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + public AdministratorsImpl( + AdministratorsClient innerClient, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String serverName, String objectId) { + this.serviceClient().delete(resourceGroupName, serverName, objectId); + } + + public void delete(String resourceGroupName, String serverName, String objectId, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, objectId, context); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String objectId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, objectId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ActiveDirectoryAdministratorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ActiveDirectoryAdministrator get(String resourceGroupName, String serverName, String objectId) { + ActiveDirectoryAdministratorInner inner = this.serviceClient().get(resourceGroupName, serverName, objectId); + if (inner != null) { + return new ActiveDirectoryAdministratorImpl(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 ActiveDirectoryAdministratorImpl(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 ActiveDirectoryAdministratorImpl(inner1, this.manager())); + } + + public ActiveDirectoryAdministrator 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, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String objectId = Utils.getValueFromIdByName(id, "administrators"); + if (objectId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'administrators'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, objectId, 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, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String objectId = Utils.getValueFromIdByName(id, "administrators"); + if (objectId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'administrators'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, objectId, 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, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String objectId = Utils.getValueFromIdByName(id, "administrators"); + if (objectId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'administrators'.", id))); + } + this.delete(resourceGroupName, serverName, objectId, 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, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String objectId = Utils.getValueFromIdByName(id, "administrators"); + if (objectId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'administrators'.", id))); + } + this.delete(resourceGroupName, serverName, objectId, context); + } + + private AdministratorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } + + public ActiveDirectoryAdministratorImpl define(String name) { + return new ActiveDirectoryAdministratorImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/BackupsClientImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/BackupsClientImpl.java new file mode 100644 index 000000000000..92b4265212c6 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/BackupsClientImpl.java @@ -0,0 +1,504 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.BackupsClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerBackupInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerBackupListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BackupsClient. */ +public final class BackupsClientImpl implements BackupsClient { + /** The proxy service used to perform REST calls. */ + private final BackupsService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of BackupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BackupsClientImpl(PostgreSqlManagementClientImpl client) { + this.service = RestProxy.create(BackupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientBackups to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface BackupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("backupName") String backupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get specific backup 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 backupName The name of the backup. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific backup for a given server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String backupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + backupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get specific backup 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 backupName The name of the backup. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific backup for a given server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String backupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + backupName, + accept, + context); + } + + /** + * Get specific backup 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 backupName The name of the backup. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific backup for a given server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String resourceGroupName, String serverName, String backupName) { + return getWithResponseAsync(resourceGroupName, serverName, backupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get specific backup 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 backupName The name of the backup. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific backup for a given server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String backupName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, backupName, context).block(); + } + + /** + * Get specific backup 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 backupName The name of the backup. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific backup for a given server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerBackupInner get(String resourceGroupName, String serverName, String backupName) { + return getWithResponse(resourceGroupName, serverName, backupName, Context.NONE).getValue(); + } + + /** + * List all the backups 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 server backups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the backups 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 server backups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the backups 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 server backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * List all the backups 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 server backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the backups 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 server backups 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 backups 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 server backups 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 server backups 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 server backups 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/BackupsImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/BackupsImpl.java new file mode 100644 index 000000000000..f88270b76b40 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/BackupsImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.BackupsClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerBackupInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Backups; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerBackup; + +public final class BackupsImpl implements Backups { + private static final ClientLogger LOGGER = new ClientLogger(BackupsImpl.class); + + private final BackupsClient innerClient; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + public BackupsImpl( + BackupsClient innerClient, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String backupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, backupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerBackupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerBackup get(String resourceGroupName, String serverName, String backupName) { + ServerBackupInner inner = this.serviceClient().get(resourceGroupName, serverName, backupName); + if (inner != null) { + return new ServerBackupImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerBackupImpl(inner1, this.manager())); + } + + private BackupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/CapabilityPropertiesImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/CapabilityPropertiesImpl.java new file mode 100644 index 000000000000..035a7c826aff --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/CapabilityPropertiesImpl.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CapabilityProperties; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.FastProvisioningEditionCapability; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.FlexibleServerEditionCapability; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.HyperscaleNodeEditionCapability; +import java.util.Collections; +import java.util.List; + +public final class CapabilityPropertiesImpl implements CapabilityProperties { + private CapabilityPropertiesInner innerObject; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + CapabilityPropertiesImpl( + CapabilityPropertiesInner innerObject, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String zone() { + return this.innerModel().zone(); + } + + public List supportedHAMode() { + List inner = this.innerModel().supportedHAMode(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public 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 Boolean fastProvisioningSupported() { + return this.innerModel().fastProvisioningSupported(); + } + + public List supportedFastProvisioningEditions() { + List inner = this.innerModel().supportedFastProvisioningEditions(); + 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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/CheckNameAvailabilitiesClientImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/CheckNameAvailabilitiesClientImpl.java new file mode 100644 index 000000000000..9f1284690cde --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/CheckNameAvailabilitiesClientImpl.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.CheckNameAvailabilitiesClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilityRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CheckNameAvailabilitiesClient. */ +public final class CheckNameAvailabilitiesClientImpl implements CheckNameAvailabilitiesClient { + /** The proxy service used to perform REST calls. */ + private final CheckNameAvailabilitiesService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of CheckNameAvailabilitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CheckNameAvailabilitiesClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy + .create(CheckNameAvailabilitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientCheckNameAvailabilities to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface CheckNameAvailabilitiesService { + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> execute( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") CheckNameAvailabilityRequest nameAvailabilityRequest, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> executeWithResponseAsync( + CheckNameAvailabilityRequest nameAvailabilityRequest) { + 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 (nameAvailabilityRequest == null) { + return Mono + .error( + new IllegalArgumentException("Parameter nameAvailabilityRequest is required and cannot be null.")); + } else { + nameAvailabilityRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .execute( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + nameAvailabilityRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> executeWithResponseAsync( + CheckNameAvailabilityRequest nameAvailabilityRequest, 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 (nameAvailabilityRequest == null) { + return Mono + .error( + new IllegalArgumentException("Parameter nameAvailabilityRequest is required and cannot be null.")); + } else { + nameAvailabilityRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .execute( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + nameAvailabilityRequest, + accept, + context); + } + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono executeAsync(CheckNameAvailabilityRequest nameAvailabilityRequest) { + 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response executeWithResponse( + CheckNameAvailabilityRequest 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NameAvailabilityInner execute(CheckNameAvailabilityRequest nameAvailabilityRequest) { + return executeWithResponse(nameAvailabilityRequest, Context.NONE).getValue(); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/CheckNameAvailabilitiesImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/CheckNameAvailabilitiesImpl.java new file mode 100644 index 000000000000..9549249dbacc --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/CheckNameAvailabilitiesImpl.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.CheckNameAvailabilitiesClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilities; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.NameAvailability; + +public final class CheckNameAvailabilitiesImpl implements CheckNameAvailabilities { + private static final ClientLogger LOGGER = new ClientLogger(CheckNameAvailabilitiesImpl.class); + + private final CheckNameAvailabilitiesClient innerClient; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + public CheckNameAvailabilitiesImpl( + CheckNameAvailabilitiesClient innerClient, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response executeWithResponse( + CheckNameAvailabilityRequest nameAvailabilityRequest, Context context) { + Response inner = + this.serviceClient().executeWithResponse(nameAvailabilityRequest, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NameAvailabilityImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public NameAvailability execute(CheckNameAvailabilityRequest 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; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/CheckNameAvailabilityWithLocationsClientImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/CheckNameAvailabilityWithLocationsClientImpl.java new file mode 100644 index 000000000000..4795bf35ff82 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/CheckNameAvailabilityWithLocationsClientImpl.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.CheckNameAvailabilityWithLocationsClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilityRequest; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CheckNameAvailabilityWithLocationsClient. + */ +public final class CheckNameAvailabilityWithLocationsClientImpl implements CheckNameAvailabilityWithLocationsClient { + /** The proxy service used to perform REST calls. */ + private final CheckNameAvailabilityWithLocationsService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of CheckNameAvailabilityWithLocationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CheckNameAvailabilityWithLocationsClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy + .create( + CheckNameAvailabilityWithLocationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientCheckNameAvailabilityWithLocations to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface CheckNameAvailabilityWithLocationsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> execute( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationName") String locationName, + @BodyParam("application/json") CheckNameAvailabilityRequest nameAvailabilityRequest, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Check the availability of name for resource. + * + * @param locationName The name of the location. + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> executeWithResponseAsync( + String locationName, CheckNameAvailabilityRequest nameAvailabilityRequest) { + 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.")); + } + if (nameAvailabilityRequest == null) { + return Mono + .error( + new IllegalArgumentException("Parameter nameAvailabilityRequest is required and cannot be null.")); + } else { + nameAvailabilityRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .execute( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + locationName, + nameAvailabilityRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Check the availability of name for resource. + * + * @param locationName The name of the location. + * @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> executeWithResponseAsync( + String locationName, CheckNameAvailabilityRequest nameAvailabilityRequest, 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.")); + } + if (nameAvailabilityRequest == null) { + return Mono + .error( + new IllegalArgumentException("Parameter nameAvailabilityRequest is required and cannot be null.")); + } else { + nameAvailabilityRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .execute( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + locationName, + nameAvailabilityRequest, + accept, + context); + } + + /** + * Check the availability of name for resource. + * + * @param locationName The name of the location. + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono executeAsync( + String locationName, CheckNameAvailabilityRequest nameAvailabilityRequest) { + return executeWithResponseAsync(locationName, nameAvailabilityRequest) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Check the availability of name for resource. + * + * @param locationName The name of the location. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response executeWithResponse( + String locationName, CheckNameAvailabilityRequest nameAvailabilityRequest, Context context) { + return executeWithResponseAsync(locationName, nameAvailabilityRequest, context).block(); + } + + /** + * Check the availability of name for resource. + * + * @param locationName The name of the location. + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NameAvailabilityInner execute(String locationName, CheckNameAvailabilityRequest nameAvailabilityRequest) { + return executeWithResponse(locationName, nameAvailabilityRequest, Context.NONE).getValue(); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/CheckNameAvailabilityWithLocationsImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/CheckNameAvailabilityWithLocationsImpl.java new file mode 100644 index 000000000000..f87140bcb49f --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/CheckNameAvailabilityWithLocationsImpl.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.CheckNameAvailabilityWithLocationsClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilityWithLocations; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.NameAvailability; + +public final class CheckNameAvailabilityWithLocationsImpl implements CheckNameAvailabilityWithLocations { + private static final ClientLogger LOGGER = new ClientLogger(CheckNameAvailabilityWithLocationsImpl.class); + + private final CheckNameAvailabilityWithLocationsClient innerClient; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + public CheckNameAvailabilityWithLocationsImpl( + CheckNameAvailabilityWithLocationsClient innerClient, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response executeWithResponse( + String locationName, CheckNameAvailabilityRequest nameAvailabilityRequest, Context context) { + Response inner = + this.serviceClient().executeWithResponse(locationName, nameAvailabilityRequest, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NameAvailabilityImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public NameAvailability execute(String locationName, CheckNameAvailabilityRequest nameAvailabilityRequest) { + NameAvailabilityInner inner = this.serviceClient().execute(locationName, nameAvailabilityRequest); + if (inner != null) { + return new NameAvailabilityImpl(inner, this.manager()); + } else { + return null; + } + } + + private CheckNameAvailabilityWithLocationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ConfigurationImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ConfigurationImpl.java new file mode 100644 index 000000000000..352b26e2ae07 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ConfigurationImpl.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Configuration; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ConfigurationDataType; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ConfigurationForUpdate; + +public final class ConfigurationImpl implements Configuration, Configuration.Definition, Configuration.Update { + private ConfigurationInner innerObject; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String value() { + return this.innerModel().value(); + } + + public String description() { + return this.innerModel().description(); + } + + public String defaultValue() { + return this.innerModel().defaultValue(); + } + + public ConfigurationDataType dataType() { + return this.innerModel().dataType(); + } + + public String allowedValues() { + return this.innerModel().allowedValues(); + } + + public String source() { + return this.innerModel().source(); + } + + public Boolean isDynamicConfig() { + return this.innerModel().isDynamicConfig(); + } + + public Boolean isReadOnly() { + return this.innerModel().isReadOnly(); + } + + public Boolean isConfigPendingRestart() { + return this.innerModel().isConfigPendingRestart(); + } + + public String unit() { + return this.innerModel().unit(); + } + + public String documentationLink() { + return this.innerModel().documentationLink(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ConfigurationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String configurationName; + + private ConfigurationForUpdate updateParameters; + + public ConfigurationImpl withExistingFlexibleServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public Configuration create() { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .put(resourceGroupName, serverName, configurationName, this.innerModel(), Context.NONE); + return this; + } + + public Configuration create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .put(resourceGroupName, serverName, configurationName, this.innerModel(), context); + return this; + } + + ConfigurationImpl( + String name, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerObject = new ConfigurationInner(); + this.serviceManager = serviceManager; + this.configurationName = name; + } + + public ConfigurationImpl update() { + this.updateParameters = new ConfigurationForUpdate(); + return this; + } + + public Configuration apply() { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .update(resourceGroupName, serverName, configurationName, updateParameters, Context.NONE); + return this; + } + + public Configuration apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .update(resourceGroupName, serverName, configurationName, updateParameters, context); + return this; + } + + ConfigurationImpl( + ConfigurationInner innerObject, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "flexibleServers"); + this.configurationName = Utils.getValueFromIdByName(innerObject.id(), "configurations"); + } + + public Configuration refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .getWithResponse(resourceGroupName, serverName, configurationName, Context.NONE) + .getValue(); + return this; + } + + public Configuration refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .getWithResponse(resourceGroupName, serverName, configurationName, context) + .getValue(); + return this; + } + + public ConfigurationImpl withValue(String value) { + if (isInCreateMode()) { + this.innerModel().withValue(value); + return this; + } else { + this.updateParameters.withValue(value); + return this; + } + } + + public ConfigurationImpl withSource(String source) { + if (isInCreateMode()) { + this.innerModel().withSource(source); + return this; + } else { + this.updateParameters.withSource(source); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ConfigurationsClientImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ConfigurationsClientImpl.java new file mode 100644 index 000000000000..63dec80d604b --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ConfigurationsClientImpl.java @@ -0,0 +1,1173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.ConfigurationsClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ConfigurationForUpdate; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ConfigurationListResult; +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 { + /** The proxy service used to perform REST calls. */ + private final ConfigurationsService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of ConfigurationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ConfigurationsClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(ConfigurationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientConfigurations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface ConfigurationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("configurationName") String configurationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}") + @ExpectedResponses({200, 201, 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") ConfigurationForUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> put( + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * List all the 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the 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 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 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 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 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String resourceGroupName, String serverName, String configurationName) { + return getWithResponseAsync(resourceGroupName, serverName, configurationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String configurationName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, configurationName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 getWithResponse(resourceGroupName, serverName, configurationName, Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationForUpdate 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 (configurationName == null) { + 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 accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + 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. + * + * @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationForUpdate 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 (configurationName == null) { + 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 accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + configurationName, + parameters, + accept, + 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 the {@link PollerFlux} for polling of represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, ConfigurationInner> beginUpdateAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationForUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, configurationName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ConfigurationInner.class, + ConfigurationInner.class, + this.client.getContext()); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ConfigurationInner> beginUpdateAsync( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationForUpdate parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(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 the {@link SyncPoller} for polling of represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ConfigurationInner> beginUpdate( + String resourceGroupName, String serverName, String configurationName, ConfigurationForUpdate parameters) { + return this.beginUpdateAsync(resourceGroupName, serverName, configurationName, parameters).getSyncPoller(); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ConfigurationInner> beginUpdate( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationForUpdate parameters, + Context context) { + return this + .beginUpdateAsync(resourceGroupName, serverName, configurationName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationForUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, configurationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationForUpdate parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, configurationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationInner update( + String resourceGroupName, String serverName, String configurationName, ConfigurationForUpdate parameters) { + return updateAsync(resourceGroupName, serverName, configurationName, parameters).block(); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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.SINGLE) + public ConfigurationInner update( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationForUpdate parameters, + Context context) { + return updateAsync(resourceGroupName, serverName, configurationName, parameters, context).block(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> putWithResponseAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner 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 (configurationName == null) { + 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 accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .put( + this.client.getEndpoint(), + this.client.getApiVersion(), + 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. + * + * @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 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) { + 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.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .put( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + configurationName, + parameters, + accept, + 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 the {@link PollerFlux} for polling of represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public 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, + this.client.getContext()); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 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 the {@link SyncPoller} for polling of represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ConfigurationInner> beginPut( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + return this.beginPutAsync(resourceGroupName, serverName, configurationName, parameters).getSyncPoller(); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ConfigurationInner> beginPut( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationInner parameters, + Context context) { + return this + .beginPutAsync(resourceGroupName, serverName, configurationName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + return beginPutAsync(resourceGroupName, serverName, configurationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 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); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationInner put( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + return putAsync(resourceGroupName, serverName, configurationName, parameters).block(); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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.SINGLE) + public ConfigurationInner put( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationInner parameters, + Context context) { + return putAsync(resourceGroupName, serverName, configurationName, parameters, 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 server configurations along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 server configurations along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ConfigurationsImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ConfigurationsImpl.java new file mode 100644 index 000000000000..ec873dc718e4 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ConfigurationsImpl.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.ConfigurationsClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Configuration; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Configurations; + +public final class ConfigurationsImpl implements Configurations { + private static final ClientLogger LOGGER = new ClientLogger(ConfigurationsImpl.class); + + private final ConfigurationsClient innerClient; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + public ConfigurationsImpl( + ConfigurationsClient innerClient, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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 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 Response getWithResponse( + String resourceGroupName, String serverName, String configurationName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, configurationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Configuration get(String resourceGroupName, String serverName, String configurationName) { + ConfigurationInner inner = this.serviceClient().get(resourceGroupName, serverName, configurationName); + if (inner != null) { + return new ConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Configuration getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String configurationName = Utils.getValueFromIdByName(id, "configurations"); + if (configurationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'configurations'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, configurationName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String configurationName = Utils.getValueFromIdByName(id, "configurations"); + if (configurationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'configurations'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, configurationName, context); + } + + private ConfigurationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } + + public ConfigurationImpl define(String name) { + return new ConfigurationImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/DatabaseImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/DatabaseImpl.java new file mode 100644 index 000000000000..fe9de97ceaca --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/DatabaseImpl.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.DatabaseInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Database; + +public final class DatabaseImpl implements Database, Database.Definition { + private DatabaseInner innerObject; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + DatabaseImpl( + DatabaseInner innerObject, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String charset() { + return this.innerModel().charset(); + } + + public String collation() { + return this.innerModel().collation(); + } + + public DatabaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + public DatabaseImpl withExistingFlexibleServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public Database create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .create(resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE); + return this; + } + + public Database create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .create(resourceGroupName, serverName, databaseName, this.innerModel(), context); + return this; + } + + DatabaseImpl( + String name, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerObject = new DatabaseInner(); + this.serviceManager = serviceManager; + this.databaseName = name; + } + + public Database refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public Database refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .getWithResponse(resourceGroupName, serverName, databaseName, context) + .getValue(); + return this; + } + + public DatabaseImpl withCharset(String charset) { + this.innerModel().withCharset(charset); + return this; + } + + public DatabaseImpl withCollation(String collation) { + this.innerModel().withCollation(collation); + return this; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/DatabasesClientImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/DatabasesClientImpl.java new file mode 100644 index 000000000000..5e2b6be578c3 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/DatabasesClientImpl.java @@ -0,0 +1,1079 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.DatabasesClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.DatabaseInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.DatabaseListResult; +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 DatabasesClient. */ +public final class DatabasesClientImpl implements DatabasesClient { + /** The proxy service used to perform REST calls. */ + private final DatabasesService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of DatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabasesClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(DatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientDatabases to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface DatabasesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @BodyParam("application/json") DatabaseInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}") + @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, + @PathParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner 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 (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a 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 represents a Database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner 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 (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + parameters, + accept, + context); + } + + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a Database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, DatabaseInner> beginCreateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatabaseInner.class, + DatabaseInner.class, + this.client.getContext()); + } + + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a Database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DatabaseInner> beginCreateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DatabaseInner.class, DatabaseInner.class, context); + } + + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatabaseInner> beginCreate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return this.beginCreateAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); + } + + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatabaseInner> beginCreate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + return this.beginCreateAsync(resourceGroupName, serverName, databaseName, parameters, context).getSyncPoller(); + } + + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a 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 represents a Database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner create( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return createAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * Creates a new database or updates an existing database. + * + * @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 parameters The required parameters for creating or updating a 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 represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner create( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + return createAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } + + /** + * Deletes a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a database. + * + * @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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context); + } + + /** + * Deletes a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) + public PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, databaseName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a database. + * + * @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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, databaseName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 databaseName) { + return this.beginDeleteAsync(resourceGroupName, serverName, databaseName).getSyncPoller(); + } + + /** + * Deletes a database. + * + * @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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, Context context) { + return this.beginDeleteAsync(resourceGroupName, serverName, databaseName, context).getSyncPoller(); + } + + /** + * Deletes a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String serverName, String databaseName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a database. + * + * @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 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) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 databaseName) { + deleteAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * Deletes a database. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String databaseName, Context context) { + deleteAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * Gets information about a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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, + databaseName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about a database. + * + * @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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, + databaseName, + accept, + context); + } + + /** + * Gets information about a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets information about a database. + * + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * Gets information about a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 DatabaseInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE).getValue(); + } + + /** + * List all the databases 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 databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the databases 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 databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the databases 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 databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * List all the databases 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 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)); + } + + /** + * List all the databases 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 databases 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 databases 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 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 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 databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/DatabasesImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/DatabasesImpl.java new file mode 100644 index 000000000000..068c767f94cd --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/DatabasesImpl.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.DatabasesClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.DatabaseInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Database; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Databases; + +public final class DatabasesImpl implements Databases { + private static final ClientLogger LOGGER = new ClientLogger(DatabasesImpl.class); + + private final DatabasesClient innerClient; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + public DatabasesImpl( + DatabasesClient innerClient, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String serverName, String databaseName) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName); + } + + public void delete(String resourceGroupName, String serverName, String databaseName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, context); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); + } + + public Database 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, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, 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, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, 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, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, 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, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, context); + } + + private DatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } + + public DatabaseImpl define(String name) { + return new DatabaseImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/FirewallRuleImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/FirewallRuleImpl.java new file mode 100644 index 000000000000..5910a4b89e85 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/FirewallRuleImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.FirewallRule; + +public final class FirewallRuleImpl implements FirewallRule, FirewallRule.Definition, FirewallRule.Update { + private FirewallRuleInner innerObject; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String startIpAddress() { + return this.innerModel().startIpAddress(); + } + + public String endIpAddress() { + return this.innerModel().endIpAddress(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public FirewallRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String firewallRuleName; + + public FirewallRuleImpl withExistingFlexibleServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public FirewallRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, serverName, firewallRuleName, this.innerModel(), Context.NONE); + return this; + } + + public FirewallRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, serverName, firewallRuleName, this.innerModel(), context); + return this; + } + + FirewallRuleImpl( + String name, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerObject = new FirewallRuleInner(); + this.serviceManager = serviceManager; + this.firewallRuleName = name; + } + + public FirewallRuleImpl update() { + return this; + } + + public FirewallRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, serverName, firewallRuleName, this.innerModel(), Context.NONE); + return this; + } + + public FirewallRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, serverName, firewallRuleName, this.innerModel(), context); + return this; + } + + FirewallRuleImpl( + FirewallRuleInner innerObject, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "flexibleServers"); + this.firewallRuleName = Utils.getValueFromIdByName(innerObject.id(), "firewallRules"); + } + + public FirewallRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .getWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE) + .getValue(); + return this; + } + + public FirewallRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .getWithResponse(resourceGroupName, serverName, firewallRuleName, context) + .getValue(); + return this; + } + + public FirewallRuleImpl withStartIpAddress(String startIpAddress) { + this.innerModel().withStartIpAddress(startIpAddress); + return this; + } + + public FirewallRuleImpl withEndIpAddress(String endIpAddress) { + this.innerModel().withEndIpAddress(endIpAddress); + return this; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/FirewallRulesClientImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/FirewallRulesClientImpl.java new file mode 100644 index 000000000000..59a4cd66ed55 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/FirewallRulesClientImpl.java @@ -0,0 +1,1112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.FirewallRulesClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.FirewallRuleListResult; +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 FirewallRulesClient. */ +public final class FirewallRulesClientImpl implements FirewallRulesClient { + /** The proxy service used to perform REST calls. */ + private final FirewallRulesService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of FirewallRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FirewallRulesClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(FirewallRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientFirewallRules to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface FirewallRulesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({200, 201, 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, + @PathParam("firewallRuleName") String firewallRuleName, + @BodyParam("application/json") FirewallRuleInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}") + @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, + @PathParam("firewallRuleName") String firewallRuleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a firewall 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 represents a server firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner 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 (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + firewallRuleName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner 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 (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + firewallRuleName, + parameters, + accept, + context); + } + + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a firewall 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 represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + FirewallRuleInner.class, + FirewallRuleInner.class, + this.client.getContext()); + } + + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a 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 the {@link PollerFlux} for polling of represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FirewallRuleInner.class, FirewallRuleInner.class, context); + } + + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a firewall 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 represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters) + .getSyncPoller(); + } + + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a 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 the {@link SyncPoller} for polling of represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a firewall 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 represents a server firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a firewall 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 represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner createOrUpdate( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters).block(); + } + + /** + * Creates a new firewall rule or updates an existing 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 parameters The required parameters for creating or updating a 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters, context).block(); + } + + /** + * Deletes a PostgreSQL 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName) { + 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 (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + firewallRuleName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a PostgreSQL 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName, 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 (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + firewallRuleName, + accept, + context); + } + + /** + * Deletes a PostgreSQL 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) + public PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String firewallRuleName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, firewallRuleName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a PostgreSQL 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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, firewallRuleName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a PostgreSQL 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 firewallRuleName) { + return this.beginDeleteAsync(resourceGroupName, serverName, firewallRuleName).getSyncPoller(); + } + + /** + * Deletes a PostgreSQL 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return this.beginDeleteAsync(resourceGroupName, serverName, firewallRuleName, context).getSyncPoller(); + } + + /** + * Deletes a PostgreSQL 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return beginDeleteAsync(resourceGroupName, serverName, firewallRuleName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a PostgreSQL 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, firewallRuleName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a PostgreSQL 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 firewallRuleName) { + deleteAsync(resourceGroupName, serverName, firewallRuleName).block(); + } + + /** + * Deletes a PostgreSQL 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String firewallRuleName, Context context) { + deleteAsync(resourceGroupName, serverName, firewallRuleName, context).block(); + } + + /** + * 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. + * @param firewallRuleName The name of the server firewall 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 represents a server firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName) { + 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 (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName 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, + firewallRuleName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName, 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 (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName 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, + firewallRuleName, + accept, + context); + } + + /** + * 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. + * @param firewallRuleName The name of the server firewall 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 represents a server firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithResponseAsync(resourceGroupName, serverName, firewallRuleName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * + * @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the firewall rules in a given 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 firewall rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the firewall rules in a given 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 firewall rules as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * List all the firewall rules in a given 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 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)); + } + + /** + * List all the firewall rules in a given 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 firewall rules 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 firewall rules in a given 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 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 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 firewall rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 firewall rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/FirewallRulesImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/FirewallRulesImpl.java new file mode 100644 index 000000000000..0b8eba8fedcf --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/FirewallRulesImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.FirewallRulesClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.FirewallRule; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.FirewallRules; + +public final class FirewallRulesImpl implements FirewallRules { + private static final ClientLogger LOGGER = new ClientLogger(FirewallRulesImpl.class); + + private final FirewallRulesClient innerClient; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + public FirewallRulesImpl( + FirewallRulesClient innerClient, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String serverName, String firewallRuleName) { + this.serviceClient().delete(resourceGroupName, serverName, firewallRuleName); + } + + public void delete(String resourceGroupName, String serverName, String firewallRuleName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, firewallRuleName, context); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, firewallRuleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FirewallRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager())); + } + + public FirewallRule 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, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, firewallRuleName, 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, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, firewallRuleName, 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, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + this.delete(resourceGroupName, serverName, firewallRuleName, 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, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + this.delete(resourceGroupName, serverName, firewallRuleName, context); + } + + private FirewallRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } + + public FirewallRuleImpl define(String name) { + return new FirewallRuleImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesClientImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesClientImpl.java new file mode 100644 index 000000000000..fa0e5384f749 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesClientImpl.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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 { + /** 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") + public 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> executeWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.execute(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get private DNS zone suffix in the cloud. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private DNS zone suffix in the cloud along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> executeWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.execute(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + } + + /** + * Get private DNS zone suffix in the cloud. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private DNS zone suffix in the cloud on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono executeAsync() { + return executeWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get private DNS zone suffix in the cloud. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private DNS zone suffix in the cloud along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response executeWithResponse(Context context) { + return executeWithResponseAsync(context).block(); + } + + /** + * 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 executeWithResponse(Context.NONE).getValue(); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesImpl.java new file mode 100644 index 000000000000..da392dbe505e --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesImpl.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.GetPrivateDnsZoneSuffixesClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.GetPrivateDnsZoneSuffixes; + +public final class GetPrivateDnsZoneSuffixesImpl implements GetPrivateDnsZoneSuffixes { + private static final ClientLogger LOGGER = new ClientLogger(GetPrivateDnsZoneSuffixesImpl.class); + + private final GetPrivateDnsZoneSuffixesClient innerClient; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + public GetPrivateDnsZoneSuffixesImpl( + GetPrivateDnsZoneSuffixesClient innerClient, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response executeWithResponse(Context context) { + return this.serviceClient().executeWithResponse(context); + } + + public String execute() { + return this.serviceClient().execute(); + } + + private GetPrivateDnsZoneSuffixesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/LocationBasedCapabilitiesClientImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/LocationBasedCapabilitiesClientImpl.java new file mode 100644 index 000000000000..a09256e10f58 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/LocationBasedCapabilitiesClientImpl.java @@ -0,0 +1,322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.LocationBasedCapabilitiesClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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 { + /** 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") + public 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 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 location capability along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 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 location capability along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/LocationBasedCapabilitiesImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/LocationBasedCapabilitiesImpl.java new file mode 100644 index 000000000000..8cb2f18bc71c --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/LocationBasedCapabilitiesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.LocationBasedCapabilitiesClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CapabilityProperties; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.LocationBasedCapabilities; + +public final class LocationBasedCapabilitiesImpl implements LocationBasedCapabilities { + private static final ClientLogger LOGGER = new ClientLogger(LocationBasedCapabilitiesImpl.class); + + private final LocationBasedCapabilitiesClient innerClient; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + public LocationBasedCapabilitiesImpl( + LocationBasedCapabilitiesClient innerClient, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/NameAvailabilityImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/NameAvailabilityImpl.java new file mode 100644 index 000000000000..9d1ea239312b --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/NameAvailabilityImpl.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilityReason; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.NameAvailability; + +public final class NameAvailabilityImpl implements NameAvailability { + private NameAvailabilityInner innerObject; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + NameAvailabilityImpl( + NameAvailabilityInner innerObject, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public CheckNameAvailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public NameAvailabilityInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/OperationListResultImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/OperationListResultImpl.java new file mode 100644 index 000000000000..175f1a47bfa6 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/OperationListResultImpl.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.OperationListResultInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Operation; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.OperationListResult; +import java.util.Collections; +import java.util.List; + +public final class OperationListResultImpl implements OperationListResult { + private OperationListResultInner innerObject; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + OperationListResultImpl( + OperationListResultInner innerObject, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public OperationListResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/OperationsClientImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..c5f5e7b85686 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/OperationsClientImpl.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.OperationsClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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 { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.DBforPostgreSQL/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync() { + 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.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + } + + /** + * Lists all of the available REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listAsync() { + return listWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Lists all of the available REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } + + /** + * Lists all of the available REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationListResultInner list() { + return listWithResponse(Context.NONE).getValue(); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/OperationsImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/OperationsImpl.java new file mode 100644 index 000000000000..0f426d15092c --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/OperationsImpl.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.OperationsClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.OperationListResultInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.OperationListResult; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + public OperationsImpl( + OperationsClient innerClient, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/PostgreSqlManagementClientBuilder.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/PostgreSqlManagementClientBuilder.java new file mode 100644 index 000000000000..3a9e79bd4a57 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/PostgreSqlManagementClientBuilder.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the PostgreSqlManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {PostgreSqlManagementClientImpl.class}) +public final class PostgreSqlManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the PostgreSqlManagementClientBuilder. + */ + public PostgreSqlManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the PostgreSqlManagementClientBuilder. + */ + public PostgreSqlManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the PostgreSqlManagementClientBuilder. + */ + public PostgreSqlManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the PostgreSqlManagementClientBuilder. + */ + public PostgreSqlManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the PostgreSqlManagementClientBuilder. + */ + public PostgreSqlManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the PostgreSqlManagementClientBuilder. + */ + public PostgreSqlManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of PostgreSqlManagementClientImpl with the provided parameters. + * + * @return an instance of PostgreSqlManagementClientImpl. + */ + public PostgreSqlManagementClientImpl buildClient() { + 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( + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + subscriptionId, + localEndpoint); + return client; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/PostgreSqlManagementClientImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/PostgreSqlManagementClientImpl.java new file mode 100644 index 000000000000..45406737bf70 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/PostgreSqlManagementClientImpl.java @@ -0,0 +1,458 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.AdministratorsClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.BackupsClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.CheckNameAvailabilitiesClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.CheckNameAvailabilityWithLocationsClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.ConfigurationsClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.DatabasesClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.FirewallRulesClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.GetPrivateDnsZoneSuffixesClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.LocationBasedCapabilitiesClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.OperationsClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.PostgreSqlManagementClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.ReplicasClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.ServersClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.VirtualNetworkSubnetUsagesClient; +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 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 { + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + 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; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The AdministratorsClient object to access its operations. */ + private final AdministratorsClient administrators; + + /** + * Gets the AdministratorsClient object to access its operations. + * + * @return the AdministratorsClient object. + */ + public AdministratorsClient getAdministrators() { + return this.administrators; + } + + /** The BackupsClient object to access its operations. */ + private final BackupsClient backups; + + /** + * Gets the BackupsClient object to access its operations. + * + * @return the BackupsClient object. + */ + public BackupsClient getBackups() { + return this.backups; + } + + /** The LocationBasedCapabilitiesClient object to access its operations. */ + private final LocationBasedCapabilitiesClient locationBasedCapabilities; + + /** + * Gets the LocationBasedCapabilitiesClient object to access its operations. + * + * @return the LocationBasedCapabilitiesClient object. + */ + public LocationBasedCapabilitiesClient getLocationBasedCapabilities() { + return this.locationBasedCapabilities; + } + + /** 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 CheckNameAvailabilityWithLocationsClient object to access its operations. */ + private final CheckNameAvailabilityWithLocationsClient checkNameAvailabilityWithLocations; + + /** + * Gets the CheckNameAvailabilityWithLocationsClient object to access its operations. + * + * @return the CheckNameAvailabilityWithLocationsClient object. + */ + public CheckNameAvailabilityWithLocationsClient getCheckNameAvailabilityWithLocations() { + return this.checkNameAvailabilityWithLocations; + } + + /** The ConfigurationsClient object to access its operations. */ + private final ConfigurationsClient configurations; + + /** + * Gets the ConfigurationsClient object to access its operations. + * + * @return the ConfigurationsClient object. + */ + public ConfigurationsClient getConfigurations() { + return this.configurations; + } + + /** 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 FirewallRulesClient object to access its operations. */ + private final FirewallRulesClient firewallRules; + + /** + * Gets the FirewallRulesClient object to access its operations. + * + * @return the FirewallRulesClient object. + */ + public FirewallRulesClient getFirewallRules() { + return this.firewallRules; + } + + /** The ServersClient object to access its operations. */ + private final ServersClient servers; + + /** + * Gets the ServersClient object to access its operations. + * + * @return the ServersClient object. + */ + public ServersClient getServers() { + return this.servers; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The GetPrivateDnsZoneSuffixesClient object to access its operations. */ + private final GetPrivateDnsZoneSuffixesClient getPrivateDnsZoneSuffixes; + + /** + * Gets the GetPrivateDnsZoneSuffixesClient object to access its operations. + * + * @return the GetPrivateDnsZoneSuffixesClient object. + */ + public GetPrivateDnsZoneSuffixesClient getGetPrivateDnsZoneSuffixes() { + return this.getPrivateDnsZoneSuffixes; + } + + /** 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 VirtualNetworkSubnetUsagesClient object to access its operations. */ + private final VirtualNetworkSubnetUsagesClient virtualNetworkSubnetUsages; + + /** + * Gets the VirtualNetworkSubnetUsagesClient object to access its operations. + * + * @return the VirtualNetworkSubnetUsagesClient object. + */ + public VirtualNetworkSubnetUsagesClient getVirtualNetworkSubnetUsages() { + return this.virtualNetworkSubnetUsages; + } + + /** + * Initializes an instance of PostgreSqlManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + PostgreSqlManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2022-12-01"; + this.administrators = new AdministratorsClientImpl(this); + this.backups = new BackupsClientImpl(this); + this.locationBasedCapabilities = new LocationBasedCapabilitiesClientImpl(this); + this.checkNameAvailabilities = new CheckNameAvailabilitiesClientImpl(this); + this.checkNameAvailabilityWithLocations = new CheckNameAvailabilityWithLocationsClientImpl(this); + this.configurations = new ConfigurationsClientImpl(this); + this.databases = new DatabasesClientImpl(this); + this.firewallRules = new FirewallRulesClientImpl(this); + this.servers = new ServersClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.getPrivateDnsZoneSuffixes = new GetPrivateDnsZoneSuffixesClientImpl(this); + this.replicas = new ReplicasClientImpl(this); + this.virtualNetworkSubnetUsages = new VirtualNetworkSubnetUsagesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ReplicasClientImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ReplicasClientImpl.java new file mode 100644 index 000000000000..1137de518552 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ReplicasClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.ReplicasClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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/flexibleServers/{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 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(), 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 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(), 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) + public 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ReplicasImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ReplicasImpl.java new file mode 100644 index 000000000000..7170efca7fbe --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ReplicasImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.ReplicasClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Replicas; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + public ReplicasImpl( + ReplicasClient innerClient, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ServerBackupImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ServerBackupImpl.java new file mode 100644 index 000000000000..bd2cc787ceae --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ServerBackupImpl.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerBackupInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Origin; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerBackup; +import java.time.OffsetDateTime; + +public final class ServerBackupImpl implements ServerBackup { + private ServerBackupInner innerObject; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + ServerBackupImpl( + ServerBackupInner innerObject, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Origin backupType() { + return this.innerModel().backupType(); + } + + public OffsetDateTime completedTime() { + return this.innerModel().completedTime(); + } + + public String source() { + return this.innerModel().source(); + } + + public ServerBackupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ServerImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ServerImpl.java new file mode 100644 index 000000000000..298a2d7e964d --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ServerImpl.java @@ -0,0 +1,455 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.AuthConfig; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Backup; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CreateMode; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CreateModeForUpdate; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.DataEncryption; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.HighAvailability; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Network; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ReplicationRole; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.RestartParameter; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Server; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerForUpdate; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerState; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerVersion; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Sku; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Storage; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.UserAssignedIdentity; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class ServerImpl implements Server, Server.Definition, Server.Update { + private ServerInner innerObject; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public UserAssignedIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String administratorLogin() { + return this.innerModel().administratorLogin(); + } + + public String administratorLoginPassword() { + return this.innerModel().administratorLoginPassword(); + } + + public ServerVersion version() { + return this.innerModel().version(); + } + + public String minorVersion() { + return this.innerModel().minorVersion(); + } + + public ServerState state() { + return this.innerModel().state(); + } + + public String fullyQualifiedDomainName() { + return this.innerModel().fullyQualifiedDomainName(); + } + + public Storage storage() { + return this.innerModel().storage(); + } + + public AuthConfig authConfig() { + return this.innerModel().authConfig(); + } + + public DataEncryption dataEncryption() { + return this.innerModel().dataEncryption(); + } + + public Backup backup() { + return this.innerModel().backup(); + } + + public Network network() { + return this.innerModel().network(); + } + + public HighAvailability highAvailability() { + return this.innerModel().highAvailability(); + } + + public MaintenanceWindow maintenanceWindow() { + return this.innerModel().maintenanceWindow(); + } + + public String sourceServerResourceId() { + return this.innerModel().sourceServerResourceId(); + } + + public OffsetDateTime pointInTimeUtc() { + return this.innerModel().pointInTimeUtc(); + } + + public String availabilityZone() { + return this.innerModel().availabilityZone(); + } + + public ReplicationRole replicationRole() { + return this.innerModel().replicationRole(); + } + + public Integer replicaCapacity() { + return this.innerModel().replicaCapacity(); + } + + public CreateMode createMode() { + return this.innerModel().createMode(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ServerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private ServerForUpdate updateParameters; + + public ServerImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Server create() { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .create(resourceGroupName, serverName, this.innerModel(), Context.NONE); + return this; + } + + public Server create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .create(resourceGroupName, serverName, this.innerModel(), context); + return this; + } + + ServerImpl( + String name, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerObject = new ServerInner(); + this.serviceManager = serviceManager; + this.serverName = name; + } + + public ServerImpl update() { + this.updateParameters = new ServerForUpdate(); + return this; + } + + public Server apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .update(resourceGroupName, serverName, updateParameters, Context.NONE); + return this; + } + + public Server apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .update(resourceGroupName, serverName, updateParameters, context); + return this; + } + + ServerImpl( + ServerInner innerObject, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "flexibleServers"); + } + + public Server refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .getByResourceGroupWithResponse(resourceGroupName, serverName, Context.NONE) + .getValue(); + return this; + } + + public Server refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .getByResourceGroupWithResponse(resourceGroupName, serverName, context) + .getValue(); + return this; + } + + 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 ServerImpl withRegion(Region location) { + this.innerModel().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 withIdentity(UserAssignedIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public ServerImpl withAdministratorLogin(String administratorLogin) { + this.innerModel().withAdministratorLogin(administratorLogin); + 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) { + if (isInCreateMode()) { + this.innerModel().withVersion(version); + return this; + } else { + this.updateParameters.withVersion(version); + return this; + } + } + + public ServerImpl withStorage(Storage storage) { + if (isInCreateMode()) { + this.innerModel().withStorage(storage); + return this; + } else { + this.updateParameters.withStorage(storage); + return this; + } + } + + public ServerImpl withAuthConfig(AuthConfig authConfig) { + if (isInCreateMode()) { + this.innerModel().withAuthConfig(authConfig); + return this; + } else { + this.updateParameters.withAuthConfig(authConfig); + return this; + } + } + + public ServerImpl withDataEncryption(DataEncryption dataEncryption) { + if (isInCreateMode()) { + this.innerModel().withDataEncryption(dataEncryption); + return this; + } else { + this.updateParameters.withDataEncryption(dataEncryption); + return this; + } + } + + public ServerImpl withBackup(Backup backup) { + if (isInCreateMode()) { + this.innerModel().withBackup(backup); + return this; + } else { + this.updateParameters.withBackup(backup); + return this; + } + } + + public ServerImpl withNetwork(Network network) { + if (isInCreateMode()) { + this.innerModel().withNetwork(network); + return this; + } else { + this.updateParameters.withNetwork(network); + return this; + } + } + + public ServerImpl withHighAvailability(HighAvailability highAvailability) { + if (isInCreateMode()) { + this.innerModel().withHighAvailability(highAvailability); + return this; + } else { + this.updateParameters.withHighAvailability(highAvailability); + return this; + } + } + + public ServerImpl withSourceServerResourceId(String sourceServerResourceId) { + this.innerModel().withSourceServerResourceId(sourceServerResourceId); + return this; + } + + public ServerImpl withPointInTimeUtc(OffsetDateTime pointInTimeUtc) { + this.innerModel().withPointInTimeUtc(pointInTimeUtc); + return this; + } + + public ServerImpl withAvailabilityZone(String availabilityZone) { + this.innerModel().withAvailabilityZone(availabilityZone); + return this; + } + + public ServerImpl withReplicationRole(ReplicationRole replicationRole) { + if (isInCreateMode()) { + this.innerModel().withReplicationRole(replicationRole); + return this; + } else { + this.updateParameters.withReplicationRole(replicationRole); + return this; + } + } + + public ServerImpl withCreateMode(CreateMode createMode) { + this.innerModel().withCreateMode(createMode); + return this; + } + + public ServerImpl withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + this.updateParameters.withMaintenanceWindow(maintenanceWindow); + return this; + } + + public ServerImpl withCreateMode(CreateModeForUpdate createMode) { + this.updateParameters.withCreateMode(createMode); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ServersClientImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ServersClientImpl.java new file mode 100644 index 000000000000..d0e359c59732 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ServersClientImpl.java @@ -0,0 +1,2304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.ServersClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.RestartParameter; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerForUpdate; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerListResult; +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 { + /** The proxy service used to perform REST calls. */ + private final ServersService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of ServersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServersClientImpl(PostgreSqlManagementClientImpl client) { + this.service = RestProxy.create(ServersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientServers to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface ServersService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @BodyParam("application/json") ServerInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}") + @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, + @BodyParam("application/json") ServerForUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}") + @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/flexibleServers/{serverName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @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/flexibleServers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @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("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/flexibleServers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> restart( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for 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 represents a server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, ServerInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for 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 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) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for 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 the {@link PollerFlux} for polling of represents a server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, ServerInner> beginCreateAsync( + String resourceGroupName, String serverName, ServerInner parameters) { + Mono>> mono = createWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, this.client.getContext()); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for 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 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) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, context); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for 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 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) { + return this.beginCreateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for 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 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) { + return this.beginCreateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for 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 represents a server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(String resourceGroupName, String serverName, ServerInner parameters) { + return beginCreateAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for 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 represents a server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String serverName, ServerInner parameters, Context context) { + return beginCreateAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for 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 represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner create(String resourceGroupName, String serverName, ServerInner parameters) { + return createAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * Creates a new server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for 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 represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner create(String resourceGroupName, String serverName, ServerInner parameters, Context context) { + return createAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, ServerForUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @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) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, ServerInner> beginUpdateAsync( + String resourceGroupName, String serverName, ServerForUpdate parameters) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, this.client.getContext()); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @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) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, context); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerInner> beginUpdate( + String resourceGroupName, String serverName, ServerForUpdate parameters) { + return this.beginUpdateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @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) { + return this.beginUpdateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateAsync(String resourceGroupName, String serverName, ServerForUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @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) { + return beginUpdateAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner update(String resourceGroupName, String serverName, ServerForUpdate parameters) { + return updateAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner update( + String resourceGroupName, String serverName, ServerForUpdate parameters, Context context) { + return updateAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * Deletes 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public 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 accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes 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 {@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 accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context); + } + + /** + * Deletes 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public 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 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 {@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 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName) { + return this.beginDeleteAsync(resourceGroupName, serverName).getSyncPoller(); + } + + /** + * Deletes 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 {@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 this.beginDeleteAsync(resourceGroupName, serverName, context).getSyncPoller(); + } + + /** + * Deletes 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String serverName) { + return beginDeleteAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes 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 {@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 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 delete(String resourceGroupName, String serverName) { + deleteAsync(resourceGroupName, serverName).block(); + } + + /** + * Deletes 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 delete(String resourceGroupName, String serverName, Context context) { + deleteAsync(resourceGroupName, serverName, context).block(); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getByResourceGroupWithResponseAsync( + 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 + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + 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 + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getByResourceGroupAsync(String resourceGroupName, String serverName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, serverName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String serverName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, serverName, context).block(); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ServerInner getByResourceGroup(String resourceGroupName, String serverName) { + return getByResourceGroupWithResponse(resourceGroupName, serverName, Context.NONE).getValue(); + } + + /** + * List all the servers in a given resource group. + * + * @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 list of servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + 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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + 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 servers in a given resource group. + * + * @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 list of servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + 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 (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 accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the servers in a given resource group. + * + * @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 list of servers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List all the servers in a given resource group. + * + * @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 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)); + } + + /** + * List all the servers in a given resource group. + * + * @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 list of servers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List all the servers in a given resource group. + * + * @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 list of servers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List all the servers in a given subscription. + * + * @throws ManagementException thrown if 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> listSinglePageAsync() { + 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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + 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 servers in a given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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> listSinglePageAsync(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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the servers in a given subscription. + * + * @throws ManagementException thrown if 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) + public PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all the servers in a given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the servers in a given subscription. + * + * @throws ManagementException thrown if 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 list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all the servers in a given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 list(Context context) { + return new PagedIterable<>(listAsync(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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> restartWithResponseAsync( + String resourceGroupName, String serverName, RestartParameter parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .restart( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> restartWithResponseAsync( + String resourceGroupName, String serverName, RestartParameter parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .restart( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + 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 ManagementException 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) + public PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String serverName, RestartParameter parameters) { + Mono>> mono = restartWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Restarts 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, Void> beginRestartAsync(String resourceGroupName, String serverName) { + final RestartParameter parameters = null; + Mono>> mono = restartWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String serverName, RestartParameter parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + restartWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Restarts 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart(String resourceGroupName, String serverName) { + final RestartParameter parameters = null; + return this.beginRestartAsync(resourceGroupName, serverName, parameters).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String serverName, RestartParameter parameters, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono restartAsync(String resourceGroupName, String serverName, RestartParameter parameters) { + return beginRestartAsync(resourceGroupName, serverName, parameters) + .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono restartAsync(String resourceGroupName, String serverName) { + final RestartParameter parameters = null; + return beginRestartAsync(resourceGroupName, serverName, parameters) + .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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restartAsync( + String resourceGroupName, String serverName, RestartParameter parameters, Context context) { + return beginRestartAsync(resourceGroupName, serverName, parameters, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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) { + final RestartParameter parameters = null; + restartAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * 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 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, Void> beginStartAsync(String resourceGroupName, String serverName) { + Mono>> mono = startWithResponseAsync(resourceGroupName, serverName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart(String resourceGroupName, String serverName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart(String resourceGroupName, String serverName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String serverName, Context context) { + return beginStartAsync(resourceGroupName, serverName, context) + .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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, Void> beginStopAsync(String resourceGroupName, String serverName) { + Mono>> mono = stopWithResponseAsync(resourceGroupName, serverName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStop(String resourceGroupName, String serverName) { + return this.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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStop(String resourceGroupName, String serverName, Context context) { + return this.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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync(String resourceGroupName, String serverName, Context context) { + return beginStopAsync(resourceGroupName, serverName, context) + .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 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 servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ServersImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ServersImpl.java new file mode 100644 index 000000000000..bf9ee14b1c1d --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/ServersImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.ServersClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.RestartParameter; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Server; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Servers; + +public final class ServersImpl implements Servers { + private static final ClientLogger LOGGER = new ClientLogger(ServersImpl.class); + + private final ServersClient innerClient; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + public ServersImpl( + ServersClient innerClient, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 Response getByResourceGroupWithResponse( + String resourceGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, serverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + } + + 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 Server 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, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, serverName, 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, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, serverName, 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, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + this.delete(resourceGroupName, serverName, 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, "flexibleServers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + this.delete(resourceGroupName, serverName, context); + } + + private ServersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } + + public ServerImpl define(String name) { + return new ServerImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/Utils.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/Utils.java new file mode 100644 index 000000000000..e9014b1d9df3 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/VirtualNetworkSubnetUsageResultImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/VirtualNetworkSubnetUsageResultImpl.java new file mode 100644 index 000000000000..c8ca7c081de1 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/VirtualNetworkSubnetUsageResultImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.DelegatedSubnetUsage; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.VirtualNetworkSubnetUsageResult; +import java.util.Collections; +import java.util.List; + +public final class VirtualNetworkSubnetUsageResultImpl implements VirtualNetworkSubnetUsageResult { + private VirtualNetworkSubnetUsageResultInner innerObject; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + VirtualNetworkSubnetUsageResultImpl( + VirtualNetworkSubnetUsageResultInner innerObject, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List delegatedSubnetsUsage() { + List inner = this.innerModel().delegatedSubnetsUsage(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String location() { + return this.innerModel().location(); + } + + public String subscriptionId() { + return this.innerModel().subscriptionId(); + } + + public VirtualNetworkSubnetUsageResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesClientImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesClientImpl.java new file mode 100644 index 000000000000..06b2fa8c543b --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesClientImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.VirtualNetworkSubnetUsagesClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; +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 { + /** The proxy service used to perform REST calls. */ + private final VirtualNetworkSubnetUsagesService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of VirtualNetworkSubnetUsagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualNetworkSubnetUsagesClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy + .create( + VirtualNetworkSubnetUsagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientVirtualNetworkSubnetUsages to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface VirtualNetworkSubnetUsagesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkVirtualNetworkSubnetUsage") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> execute( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationName") String locationName, + @BodyParam("application/json") VirtualNetworkSubnetUsageParameter parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get virtual network subnet usage for a given vNet resource id. + * + * @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 along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> executeWithResponseAsync( + String locationName, VirtualNetworkSubnetUsageParameter 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 (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 accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .execute( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + locationName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get virtual network subnet usage for a given vNet resource id. + * + * @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 along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> executeWithResponseAsync( + String locationName, VirtualNetworkSubnetUsageParameter 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 (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 accept = "application/json"; + context = this.client.mergeContext(context); + return service + .execute( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + locationName, + parameters, + accept, + context); + } + + /** + * Get virtual network subnet usage for a given vNet resource id. + * + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono executeAsync( + String locationName, VirtualNetworkSubnetUsageParameter parameters) { + return executeWithResponseAsync(locationName, parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get virtual network subnet usage for a given vNet resource id. + * + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response executeWithResponse( + String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context) { + return executeWithResponseAsync(locationName, parameters, context).block(); + } + + /** + * Get virtual network subnet usage for a given vNet resource id. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkSubnetUsageResultInner execute( + String locationName, VirtualNetworkSubnetUsageParameter parameters) { + return executeWithResponse(locationName, parameters, Context.NONE).getValue(); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesImpl.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesImpl.java new file mode 100644 index 000000000000..f0e00cd057af --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesImpl.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.VirtualNetworkSubnetUsagesClient; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.VirtualNetworkSubnetUsageResult; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.VirtualNetworkSubnetUsages; + +public final class VirtualNetworkSubnetUsagesImpl implements VirtualNetworkSubnetUsages { + private static final ClientLogger LOGGER = new ClientLogger(VirtualNetworkSubnetUsagesImpl.class); + + private final VirtualNetworkSubnetUsagesClient innerClient; + + private final com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager; + + public VirtualNetworkSubnetUsagesImpl( + VirtualNetworkSubnetUsagesClient innerClient, + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response executeWithResponse( + String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context) { + Response inner = + this.serviceClient().executeWithResponse(locationName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualNetworkSubnetUsageResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VirtualNetworkSubnetUsageResult execute(String locationName, VirtualNetworkSubnetUsageParameter parameters) { + VirtualNetworkSubnetUsageResultInner inner = this.serviceClient().execute(locationName, parameters); + if (inner != null) { + return new VirtualNetworkSubnetUsageResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private VirtualNetworkSubnetUsagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/package-info.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/package-info.java new file mode 100644 index 000000000000..eb9a48fb8e3c --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for PostgreSqlManagementClient. 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 com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.implementation; diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ActiveDirectoryAdministrator.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ActiveDirectoryAdministrator.java new file mode 100644 index 000000000000..9cd81b52af8a --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ActiveDirectoryAdministrator.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ActiveDirectoryAdministratorInner; + +/** An immutable client-side representation of ActiveDirectoryAdministrator. */ +public interface ActiveDirectoryAdministrator { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the principalType property: The principal type used to represent the type of Active Directory Administrator. + * + * @return the principalType value. + */ + PrincipalType principalType(); + + /** + * Gets the principalName property: Active Directory administrator principal name. + * + * @return the principalName value. + */ + String principalName(); + + /** + * Gets the objectId property: The objectId of the Active Directory administrator. + * + * @return the objectId value. + */ + String objectId(); + + /** + * Gets the tenantId property: The tenantId of the Active Directory administrator. + * + * @return the tenantId value. + */ + String tenantId(); + + /** + * Gets the inner + * com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ActiveDirectoryAdministratorInner + * object. + * + * @return the inner object. + */ + ActiveDirectoryAdministratorInner innerModel(); + + /** The entirety of the ActiveDirectoryAdministrator definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ActiveDirectoryAdministrator definition stages. */ + interface DefinitionStages { + /** The first stage of the ActiveDirectoryAdministrator definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ActiveDirectoryAdministrator 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 withExistingFlexibleServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ActiveDirectoryAdministrator 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.WithPrincipalType, + DefinitionStages.WithPrincipalName, + DefinitionStages.WithTenantId { + /** + * Executes the create request. + * + * @return the created resource. + */ + ActiveDirectoryAdministrator create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ActiveDirectoryAdministrator create(Context context); + } + /** The stage of the ActiveDirectoryAdministrator definition allowing to specify principalType. */ + interface WithPrincipalType { + /** + * Specifies the principalType property: The principal type used to represent the type of Active Directory + * Administrator.. + * + * @param principalType The principal type used to represent the type of Active Directory Administrator. + * @return the next definition stage. + */ + WithCreate withPrincipalType(PrincipalType principalType); + } + /** The stage of the ActiveDirectoryAdministrator definition allowing to specify principalName. */ + interface WithPrincipalName { + /** + * Specifies the principalName property: Active Directory administrator principal name.. + * + * @param principalName Active Directory administrator principal name. + * @return the next definition stage. + */ + WithCreate withPrincipalName(String principalName); + } + /** The stage of the ActiveDirectoryAdministrator definition allowing to specify tenantId. */ + interface WithTenantId { + /** + * Specifies the tenantId property: The tenantId of the Active Directory administrator.. + * + * @param tenantId The tenantId of the Active Directory administrator. + * @return the next definition stage. + */ + WithCreate withTenantId(String tenantId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ActiveDirectoryAdministrator refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ActiveDirectoryAdministrator refresh(Context context); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ActiveDirectoryAdministratorAdd.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ActiveDirectoryAdministratorAdd.java new file mode 100644 index 000000000000..28fb14b584ba --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ActiveDirectoryAdministratorAdd.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.AdministratorPropertiesForAdd; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents an Active Directory administrator. */ +@Fluent +public final class ActiveDirectoryAdministratorAdd { + /* + * Properties of the active directory administrator. + */ + @JsonProperty(value = "properties") + private AdministratorPropertiesForAdd innerProperties; + + /** Creates an instance of ActiveDirectoryAdministratorAdd class. */ + public ActiveDirectoryAdministratorAdd() { + } + + /** + * Get the innerProperties property: Properties of the active directory administrator. + * + * @return the innerProperties value. + */ + private AdministratorPropertiesForAdd innerProperties() { + return this.innerProperties; + } + + /** + * Get the principalType property: The principal type used to represent the type of Active Directory Administrator. + * + * @return the principalType value. + */ + public PrincipalType principalType() { + return this.innerProperties() == null ? null : this.innerProperties().principalType(); + } + + /** + * Set the principalType property: The principal type used to represent the type of Active Directory Administrator. + * + * @param principalType the principalType value to set. + * @return the ActiveDirectoryAdministratorAdd object itself. + */ + public ActiveDirectoryAdministratorAdd withPrincipalType(PrincipalType principalType) { + if (this.innerProperties() == null) { + this.innerProperties = new AdministratorPropertiesForAdd(); + } + this.innerProperties().withPrincipalType(principalType); + return this; + } + + /** + * Get the principalName property: Active Directory administrator principal name. + * + * @return the principalName value. + */ + public String principalName() { + return this.innerProperties() == null ? null : this.innerProperties().principalName(); + } + + /** + * Set the principalName property: Active Directory administrator principal name. + * + * @param principalName the principalName value to set. + * @return the ActiveDirectoryAdministratorAdd object itself. + */ + public ActiveDirectoryAdministratorAdd withPrincipalName(String principalName) { + if (this.innerProperties() == null) { + this.innerProperties = new AdministratorPropertiesForAdd(); + } + this.innerProperties().withPrincipalName(principalName); + return this; + } + + /** + * Get the tenantId property: The tenantId of the Active Directory administrator. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenantId of the Active Directory administrator. + * + * @param tenantId the tenantId value to set. + * @return the ActiveDirectoryAdministratorAdd object itself. + */ + public ActiveDirectoryAdministratorAdd withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new AdministratorPropertiesForAdd(); + } + 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ActiveDirectoryAuthEnum.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ActiveDirectoryAuthEnum.java new file mode 100644 index 000000000000..fee125857165 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ActiveDirectoryAuthEnum.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** If Enabled, Azure Active Directory authentication is enabled. */ +public final class ActiveDirectoryAuthEnum extends ExpandableStringEnum { + /** Static value Enabled for ActiveDirectoryAuthEnum. */ + public static final ActiveDirectoryAuthEnum ENABLED = fromString("Enabled"); + + /** Static value Disabled for ActiveDirectoryAuthEnum. */ + public static final ActiveDirectoryAuthEnum DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of ActiveDirectoryAuthEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActiveDirectoryAuthEnum() { + } + + /** + * Creates or finds a ActiveDirectoryAuthEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActiveDirectoryAuthEnum. + */ + @JsonCreator + public static ActiveDirectoryAuthEnum fromString(String name) { + return fromString(name, ActiveDirectoryAuthEnum.class); + } + + /** + * Gets known ActiveDirectoryAuthEnum values. + * + * @return known ActiveDirectoryAuthEnum values. + */ + public static Collection values() { + return values(ActiveDirectoryAuthEnum.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/AdministratorListResult.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/AdministratorListResult.java new file mode 100644 index 000000000000..6628a0966c13 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/AdministratorListResult.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ActiveDirectoryAdministratorInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of active directory administrators. */ +@Fluent +public final class AdministratorListResult { + /* + * The list of active directory administrators + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link used to get the next page of active directory. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of AdministratorListResult class. */ + public AdministratorListResult() { + } + + /** + * Get the value property: The list of active directory administrators. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of active directory administrators. + * + * @param value the value value to set. + * @return the AdministratorListResult object itself. + */ + public AdministratorListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link used to get the next page of active directory. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of active directory. + * + * @param nextLink the nextLink value to set. + * @return the AdministratorListResult object itself. + */ + public AdministratorListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Administrators.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Administrators.java new file mode 100644 index 000000000000..9d963dcd002d --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Administrators.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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 Administrators. */ +public interface Administrators { + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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. + */ + void delete(String resourceGroupName, String serverName, String objectId); + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param objectId Guid of the objectId for the 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. + */ + void delete(String resourceGroupName, String serverName, String objectId, 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 objectId Guid of the objectId for the 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 information about a server along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String objectId, 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 objectId Guid of the objectId for the 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 information about a server. + */ + ActiveDirectoryAdministrator get(String resourceGroupName, String serverName, String objectId); + + /** + * List all the AAD administrators 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 active directory administrators as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the AAD administrators 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 active directory administrators as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Gets information about a server. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a server along with {@link Response}. + */ + ActiveDirectoryAdministrator getById(String id); + + /** + * Gets information about a server. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a server along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an Active Directory Administrator associated with the server. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ActiveDirectoryAdministrator resource. + * + * @param name resource name. + * @return the first stage of the new ActiveDirectoryAdministrator definition. + */ + ActiveDirectoryAdministrator.DefinitionStages.Blank define(String name); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ArmServerKeyType.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ArmServerKeyType.java new file mode 100644 index 000000000000..658570015b90 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ArmServerKeyType.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Data encryption type to depict if it is System Managed vs Azure Key vault. */ +public final class ArmServerKeyType extends ExpandableStringEnum { + /** Static value SystemManaged for ArmServerKeyType. */ + public static final ArmServerKeyType SYSTEM_MANAGED = fromString("SystemManaged"); + + /** Static value AzureKeyVault for ArmServerKeyType. */ + public static final ArmServerKeyType AZURE_KEY_VAULT = fromString("AzureKeyVault"); + + /** + * Creates a new instance of ArmServerKeyType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ArmServerKeyType() { + } + + /** + * Creates or finds a ArmServerKeyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ArmServerKeyType. + */ + @JsonCreator + public static ArmServerKeyType fromString(String name) { + return fromString(name, ArmServerKeyType.class); + } + + /** + * Gets known ArmServerKeyType values. + * + * @return known ArmServerKeyType values. + */ + public static Collection values() { + return values(ArmServerKeyType.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/AuthConfig.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/AuthConfig.java new file mode 100644 index 000000000000..4f4c16bebe2e --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/AuthConfig.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Authentication configuration properties of a server. */ +@Fluent +public final class AuthConfig { + /* + * If Enabled, Azure Active Directory authentication is enabled. + */ + @JsonProperty(value = "activeDirectoryAuth") + private ActiveDirectoryAuthEnum activeDirectoryAuth; + + /* + * If Enabled, Password authentication is enabled. + */ + @JsonProperty(value = "passwordAuth") + private PasswordAuthEnum passwordAuth; + + /* + * Tenant id of the server. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /** Creates an instance of AuthConfig class. */ + public AuthConfig() { + } + + /** + * Get the activeDirectoryAuth property: If Enabled, Azure Active Directory authentication is enabled. + * + * @return the activeDirectoryAuth value. + */ + public ActiveDirectoryAuthEnum activeDirectoryAuth() { + return this.activeDirectoryAuth; + } + + /** + * Set the activeDirectoryAuth property: If Enabled, Azure Active Directory authentication is enabled. + * + * @param activeDirectoryAuth the activeDirectoryAuth value to set. + * @return the AuthConfig object itself. + */ + public AuthConfig withActiveDirectoryAuth(ActiveDirectoryAuthEnum activeDirectoryAuth) { + this.activeDirectoryAuth = activeDirectoryAuth; + return this; + } + + /** + * Get the passwordAuth property: If Enabled, Password authentication is enabled. + * + * @return the passwordAuth value. + */ + public PasswordAuthEnum passwordAuth() { + return this.passwordAuth; + } + + /** + * Set the passwordAuth property: If Enabled, Password authentication is enabled. + * + * @param passwordAuth the passwordAuth value to set. + * @return the AuthConfig object itself. + */ + public AuthConfig withPasswordAuth(PasswordAuthEnum passwordAuth) { + this.passwordAuth = passwordAuth; + return this; + } + + /** + * Get the tenantId property: Tenant id of the server. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: Tenant id of the server. + * + * @param tenantId the tenantId value to set. + * @return the AuthConfig object itself. + */ + public AuthConfig withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Backup.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Backup.java new file mode 100644 index 000000000000..788923294217 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Backup.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Backup properties of a server. */ +@Fluent +public final class Backup { + /* + * 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; + + /** Creates an instance of Backup class. */ + public Backup() { + } + + /** + * 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Backups.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Backups.java new file mode 100644 index 000000000000..0c300bf00938 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Backups.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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 Backups. */ +public interface Backups { + /** + * Get specific backup 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 backupName The name of the backup. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific backup for a given server along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String backupName, Context context); + + /** + * Get specific backup 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 backupName The name of the backup. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific backup for a given server. + */ + ServerBackup get(String resourceGroupName, String serverName, String backupName); + + /** + * List all the backups 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 server backups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the backups 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 server backups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CapabilitiesListResult.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CapabilitiesListResult.java new file mode 100644 index 000000000000..4bc2b348d931 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CapabilitiesListResult.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** location capability. */ +@Immutable +public final class CapabilitiesListResult { + /* + * A list of supported capabilities. + */ + @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 CapabilitiesListResult class. */ + public CapabilitiesListResult() { + } + + /** + * Get the value property: A list of supported capabilities. + * + * @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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CapabilityProperties.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CapabilityProperties.java new file mode 100644 index 000000000000..8a6a7a1d6a68 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CapabilityProperties.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; +import java.util.List; + +/** An immutable client-side representation of CapabilityProperties. */ +public interface CapabilityProperties { + /** + * Gets the zone property: zone name. + * + * @return the zone value. + */ + String zone(); + + /** + * Gets the supportedHAMode property: Supported high availability mode. + * + * @return the supportedHAMode value. + */ + List supportedHAMode(); + + /** + * Gets the geoBackupSupported property: A value indicating whether a new server in this region can have geo-backups + * to paired region. + * + * @return the geoBackupSupported value. + */ + Boolean geoBackupSupported(); + + /** + * Gets the zoneRedundantHaSupported property: A value indicating whether a new server in this region can support + * multi zone HA. + * + * @return the zoneRedundantHaSupported value. + */ + Boolean zoneRedundantHaSupported(); + + /** + * Gets the zoneRedundantHaAndGeoBackupSupported property: A value indicating whether a new server in this region + * can have geo-backups to paired region. + * + * @return the zoneRedundantHaAndGeoBackupSupported value. + */ + Boolean zoneRedundantHaAndGeoBackupSupported(); + + /** + * Gets the supportedFlexibleServerEditions property: The supportedFlexibleServerEditions property. + * + * @return the supportedFlexibleServerEditions value. + */ + List supportedFlexibleServerEditions(); + + /** + * Gets the supportedHyperscaleNodeEditions property: The supportedHyperscaleNodeEditions property. + * + * @return the supportedHyperscaleNodeEditions value. + */ + List supportedHyperscaleNodeEditions(); + + /** + * Gets the fastProvisioningSupported property: A value indicating whether fast provisioning is supported in this + * region. + * + * @return the fastProvisioningSupported value. + */ + Boolean fastProvisioningSupported(); + + /** + * Gets the supportedFastProvisioningEditions property: The supportedFastProvisioningEditions property. + * + * @return the supportedFastProvisioningEditions value. + */ + List supportedFastProvisioningEditions(); + + /** + * Gets the status property: The status. + * + * @return the status value. + */ + String status(); + + /** + * Gets the inner + * com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.CapabilityPropertiesInner + * object. + * + * @return the inner object. + */ + CapabilityPropertiesInner innerModel(); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CheckNameAvailabilities.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CheckNameAvailabilities.java new file mode 100644 index 000000000000..8f6c1c0b7bfb --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CheckNameAvailabilities.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of CheckNameAvailabilities. */ +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 along with {@link Response}. + */ + Response executeWithResponse( + CheckNameAvailabilityRequest nameAvailabilityRequest, Context context); + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + NameAvailability execute(CheckNameAvailabilityRequest nameAvailabilityRequest); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CheckNameAvailabilityReason.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CheckNameAvailabilityReason.java new file mode 100644 index 000000000000..e6ee1ff0a31f --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CheckNameAvailabilityReason.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The reason why the given name is not available. */ +public final class CheckNameAvailabilityReason extends ExpandableStringEnum { + /** Static value Invalid for CheckNameAvailabilityReason. */ + public static final CheckNameAvailabilityReason INVALID = fromString("Invalid"); + + /** Static value AlreadyExists for CheckNameAvailabilityReason. */ + public static final CheckNameAvailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates a new instance of CheckNameAvailabilityReason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CheckNameAvailabilityReason() { + } + + /** + * Creates or finds a CheckNameAvailabilityReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding CheckNameAvailabilityReason. + */ + @JsonCreator + public static CheckNameAvailabilityReason fromString(String name) { + return fromString(name, CheckNameAvailabilityReason.class); + } + + /** + * Gets known CheckNameAvailabilityReason values. + * + * @return known CheckNameAvailabilityReason values. + */ + public static Collection values() { + return values(CheckNameAvailabilityReason.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CheckNameAvailabilityRequest.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CheckNameAvailabilityRequest.java new file mode 100644 index 000000000000..05d3acfacbaf --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CheckNameAvailabilityRequest.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The check availability request body. */ +@Fluent +public final class CheckNameAvailabilityRequest { + /* + * The name of the resource for which availability needs to be checked. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The resource type. + */ + @JsonProperty(value = "type") + private String type; + + /** Creates an instance of CheckNameAvailabilityRequest class. */ + public CheckNameAvailabilityRequest() { + } + + /** + * Get the name property: The name of the resource for which availability needs to be checked. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the resource for which availability needs to be checked. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The resource type. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CheckNameAvailabilityResponse.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CheckNameAvailabilityResponse.java new file mode 100644 index 000000000000..0b0166ac5c92 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CheckNameAvailabilityResponse.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The check availability result. */ +@Fluent +public class CheckNameAvailabilityResponse { + /* + * Indicates if the resource name is available. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * The reason why the given name is not available. + */ + @JsonProperty(value = "reason") + private CheckNameAvailabilityReason reason; + + /* + * Detailed reason why the given name is available. + */ + @JsonProperty(value = "message") + private String message; + + /** Creates an instance of CheckNameAvailabilityResponse class. */ + public CheckNameAvailabilityResponse() { + } + + /** + * Get the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: Indicates if the resource name is available. + * + * @param nameAvailable the nameAvailable value to set. + * @return the CheckNameAvailabilityResponse object itself. + */ + public CheckNameAvailabilityResponse withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + public CheckNameAvailabilityReason reason() { + return this.reason; + } + + /** + * Set the reason property: The reason why the given name is not available. + * + * @param reason the reason value to set. + * @return the CheckNameAvailabilityResponse object itself. + */ + public CheckNameAvailabilityResponse withReason(CheckNameAvailabilityReason reason) { + this.reason = reason; + return this; + } + + /** + * Get the message property: Detailed reason why the given name is available. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Detailed reason why the given name is available. + * + * @param message the message value to set. + * @return the CheckNameAvailabilityResponse object itself. + */ + public CheckNameAvailabilityResponse withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CheckNameAvailabilityWithLocations.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CheckNameAvailabilityWithLocations.java new file mode 100644 index 000000000000..06512e03561e --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CheckNameAvailabilityWithLocations.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of CheckNameAvailabilityWithLocations. */ +public interface CheckNameAvailabilityWithLocations { + /** + * Check the availability of name for resource. + * + * @param locationName The name of the location. + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability along with {@link Response}. + */ + Response executeWithResponse( + String locationName, CheckNameAvailabilityRequest nameAvailabilityRequest, Context context); + + /** + * Check the availability of name for resource. + * + * @param locationName The name of the location. + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + NameAvailability execute(String locationName, CheckNameAvailabilityRequest nameAvailabilityRequest); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Configuration.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Configuration.java new file mode 100644 index 000000000000..697141cc70b8 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Configuration.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ConfigurationInner; + +/** An immutable client-side representation of Configuration. */ +public interface Configuration { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the value property: Value of the configuration. + * + * @return the value value. + */ + String value(); + + /** + * Gets the description property: Description of the configuration. + * + * @return the description value. + */ + String description(); + + /** + * Gets the defaultValue property: Default value of the configuration. + * + * @return the defaultValue value. + */ + String defaultValue(); + + /** + * Gets the dataType property: Data type of the configuration. + * + * @return the dataType value. + */ + ConfigurationDataType dataType(); + + /** + * Gets the allowedValues property: Allowed values of the configuration. + * + * @return the allowedValues value. + */ + String allowedValues(); + + /** + * Gets the source property: Source of the configuration. + * + * @return the source value. + */ + String source(); + + /** + * Gets the isDynamicConfig property: Configuration dynamic or static. + * + * @return the isDynamicConfig value. + */ + Boolean isDynamicConfig(); + + /** + * Gets the isReadOnly property: Configuration read-only or not. + * + * @return the isReadOnly value. + */ + Boolean isReadOnly(); + + /** + * Gets the isConfigPendingRestart property: Configuration is pending restart or not. + * + * @return the isConfigPendingRestart value. + */ + Boolean isConfigPendingRestart(); + + /** + * Gets the unit property: Configuration unit. + * + * @return the unit value. + */ + String unit(); + + /** + * Gets the documentationLink property: Configuration documentation link. + * + * @return the documentationLink value. + */ + String documentationLink(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner + * com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ConfigurationInner + * object. + * + * @return the inner object. + */ + ConfigurationInner innerModel(); + + /** The entirety of the Configuration definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Configuration definition stages. */ + interface DefinitionStages { + /** The first stage of the Configuration definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Configuration definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingFlexibleServer(String resourceGroupName, String serverName); + } + /** + * The stage of the Configuration definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithValue, DefinitionStages.WithSource { + /** + * Executes the create request. + * + * @return the created resource. + */ + Configuration create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Configuration create(Context context); + } + /** The stage of the Configuration definition allowing to specify value. */ + interface WithValue { + /** + * Specifies the value property: Value of the configuration.. + * + * @param value Value of the configuration. + * @return the next definition stage. + */ + WithCreate withValue(String value); + } + /** The stage of the Configuration definition allowing to specify source. */ + interface WithSource { + /** + * Specifies the source property: Source of the configuration.. + * + * @param source Source of the configuration. + * @return the next definition stage. + */ + WithCreate withSource(String source); + } + } + /** + * Begins update for the Configuration resource. + * + * @return the stage of resource update. + */ + Configuration.Update update(); + + /** The template for Configuration update. */ + interface Update extends UpdateStages.WithValue, UpdateStages.WithSource { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Configuration apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Configuration apply(Context context); + } + /** The Configuration update stages. */ + interface UpdateStages { + /** The stage of the Configuration update allowing to specify value. */ + interface WithValue { + /** + * Specifies the value property: Value of the configuration.. + * + * @param value Value of the configuration. + * @return the next definition stage. + */ + Update withValue(String value); + } + /** The stage of the Configuration update allowing to specify source. */ + interface WithSource { + /** + * Specifies the source property: Source of the configuration.. + * + * @param source Source of the configuration. + * @return the next definition stage. + */ + Update withSource(String source); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Configuration refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Configuration refresh(Context context); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ConfigurationDataType.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ConfigurationDataType.java new file mode 100644 index 000000000000..f8ac6d015099 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ConfigurationDataType.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Data type of the configuration. */ +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 a new instance of ConfigurationDataType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ConfigurationDataType() { + } + + /** + * 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); + } + + /** + * Gets known ConfigurationDataType values. + * + * @return known ConfigurationDataType values. + */ + public static Collection values() { + return values(ConfigurationDataType.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ConfigurationForUpdate.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ConfigurationForUpdate.java new file mode 100644 index 000000000000..ab8aefcde015 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ConfigurationForUpdate.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ConfigurationProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a Configuration. */ +@Fluent +public final class ConfigurationForUpdate { + /* + * The properties of a configuration. + */ + @JsonProperty(value = "properties") + private ConfigurationProperties innerProperties; + + /** Creates an instance of ConfigurationForUpdate class. */ + public ConfigurationForUpdate() { + } + + /** + * Get the innerProperties property: The properties of a configuration. + * + * @return the innerProperties value. + */ + private ConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the value property: Value of the configuration. + * + * @return the value value. + */ + public String value() { + return this.innerProperties() == null ? null : this.innerProperties().value(); + } + + /** + * Set the value property: Value of the configuration. + * + * @param value the value value to set. + * @return the ConfigurationForUpdate object itself. + */ + public ConfigurationForUpdate withValue(String value) { + if (this.innerProperties() == null) { + this.innerProperties = new ConfigurationProperties(); + } + this.innerProperties().withValue(value); + return this; + } + + /** + * Get the description property: Description of the configuration. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the defaultValue property: Default value of the configuration. + * + * @return the defaultValue value. + */ + public String defaultValue() { + return this.innerProperties() == null ? null : this.innerProperties().defaultValue(); + } + + /** + * Get the dataType property: Data type of the configuration. + * + * @return the dataType value. + */ + public ConfigurationDataType dataType() { + return this.innerProperties() == null ? null : this.innerProperties().dataType(); + } + + /** + * Get the allowedValues property: Allowed values of the configuration. + * + * @return the allowedValues value. + */ + public String allowedValues() { + return this.innerProperties() == null ? null : this.innerProperties().allowedValues(); + } + + /** + * Get the source property: Source of the configuration. + * + * @return the source value. + */ + public String source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Set the source property: Source of the configuration. + * + * @param source the source value to set. + * @return the ConfigurationForUpdate object itself. + */ + public ConfigurationForUpdate withSource(String source) { + if (this.innerProperties() == null) { + this.innerProperties = new ConfigurationProperties(); + } + this.innerProperties().withSource(source); + return this; + } + + /** + * Get the isDynamicConfig property: Configuration dynamic or static. + * + * @return the isDynamicConfig value. + */ + public Boolean isDynamicConfig() { + return this.innerProperties() == null ? null : this.innerProperties().isDynamicConfig(); + } + + /** + * Get the isReadOnly property: Configuration read-only or not. + * + * @return the isReadOnly value. + */ + public Boolean isReadOnly() { + return this.innerProperties() == null ? null : this.innerProperties().isReadOnly(); + } + + /** + * Get the isConfigPendingRestart property: Configuration is pending restart or not. + * + * @return the isConfigPendingRestart value. + */ + public Boolean isConfigPendingRestart() { + return this.innerProperties() == null ? null : this.innerProperties().isConfigPendingRestart(); + } + + /** + * Get the unit property: Configuration unit. + * + * @return the unit value. + */ + public String unit() { + return this.innerProperties() == null ? null : this.innerProperties().unit(); + } + + /** + * Get the documentationLink property: Configuration documentation link. + * + * @return the documentationLink value. + */ + public String documentationLink() { + return this.innerProperties() == null ? null : this.innerProperties().documentationLink(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ConfigurationListResult.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ConfigurationListResult.java new file mode 100644 index 000000000000..06c49175c605 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ConfigurationListResult.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ConfigurationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server configurations. */ +@Fluent +public final class ConfigurationListResult { + /* + * 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; + + /** Creates an instance of ConfigurationListResult class. */ + public ConfigurationListResult() { + } + + /** + * 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 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; + } + + /** + * 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Configurations.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Configurations.java new file mode 100644 index 000000000000..3349ff472fd4 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Configurations.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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 Configurations. */ +public interface Configurations { + /** + * 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String configurationName, 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. + */ + Configuration get(String resourceGroupName, String serverName, String configurationName); + + /** + * Gets information about a configuration of server. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a configuration of server along with {@link Response}. + */ + Configuration getById(String id); + + /** + * Gets information about a configuration of server. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a configuration of server along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Configuration resource. + * + * @param name resource name. + * @return the first stage of the new Configuration definition. + */ + Configuration.DefinitionStages.Blank define(String name); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CreateMode.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CreateMode.java new file mode 100644 index 000000000000..0fc1ccfe104d --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CreateMode.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The mode to create a new PostgreSQL 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 a new instance of CreateMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CreateMode() { + } + + /** + * Creates or finds a CreateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding CreateMode. + */ + @JsonCreator + public static CreateMode fromString(String name) { + return fromString(name, CreateMode.class); + } + + /** + * Gets known CreateMode values. + * + * @return known CreateMode values. + */ + public static Collection values() { + return values(CreateMode.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CreateModeForUpdate.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CreateModeForUpdate.java new file mode 100644 index 000000000000..9de88f5c37b6 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/CreateModeForUpdate.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The mode to update a new PostgreSQL server. */ +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 a new instance of CreateModeForUpdate value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CreateModeForUpdate() { + } + + /** + * 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); + } + + /** + * Gets known CreateModeForUpdate values. + * + * @return known CreateModeForUpdate values. + */ + public static Collection values() { + return values(CreateModeForUpdate.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/DataEncryption.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/DataEncryption.java new file mode 100644 index 000000000000..ed6b16735862 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/DataEncryption.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Data encryption properties of a server. */ +@Fluent +public final class DataEncryption { + /* + * URI for the key for data encryption for primary server. + */ + @JsonProperty(value = "primaryKeyURI") + private String primaryKeyUri; + + /* + * Resource Id for the User assigned identity to be used for data encryption for primary server. + */ + @JsonProperty(value = "primaryUserAssignedIdentityId") + private String primaryUserAssignedIdentityId; + + /* + * Data encryption type to depict if it is System Managed vs Azure Key vault. + */ + @JsonProperty(value = "type") + private ArmServerKeyType type; + + /** Creates an instance of DataEncryption class. */ + public DataEncryption() { + } + + /** + * Get the primaryKeyUri property: URI for the key for data encryption for primary server. + * + * @return the primaryKeyUri value. + */ + public String primaryKeyUri() { + return this.primaryKeyUri; + } + + /** + * Set the primaryKeyUri property: URI for the key for data encryption for primary server. + * + * @param primaryKeyUri the primaryKeyUri value to set. + * @return the DataEncryption object itself. + */ + public DataEncryption withPrimaryKeyUri(String primaryKeyUri) { + this.primaryKeyUri = primaryKeyUri; + return this; + } + + /** + * Get the primaryUserAssignedIdentityId property: Resource Id for the User assigned identity to be used for data + * encryption for primary server. + * + * @return the primaryUserAssignedIdentityId value. + */ + public String primaryUserAssignedIdentityId() { + return this.primaryUserAssignedIdentityId; + } + + /** + * Set the primaryUserAssignedIdentityId property: Resource Id for the User assigned identity to be used for data + * encryption for primary server. + * + * @param primaryUserAssignedIdentityId the primaryUserAssignedIdentityId value to set. + * @return the DataEncryption object itself. + */ + public DataEncryption withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + this.primaryUserAssignedIdentityId = primaryUserAssignedIdentityId; + return this; + } + + /** + * Get the type property: Data encryption type to depict if it is System Managed vs Azure Key vault. + * + * @return the type value. + */ + public ArmServerKeyType type() { + return this.type; + } + + /** + * Set the type property: Data encryption type to depict if it is System Managed vs Azure Key vault. + * + * @param type the type value to set. + * @return the DataEncryption object itself. + */ + public DataEncryption withType(ArmServerKeyType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Database.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Database.java new file mode 100644 index 000000000000..70befa3768d5 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Database.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.DatabaseInner; + +/** An immutable client-side representation of Database. */ +public interface Database { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the charset property: The charset of the database. + * + * @return the charset value. + */ + String charset(); + + /** + * Gets the collation property: The collation of the database. + * + * @return the collation value. + */ + String collation(); + + /** + * Gets the inner + * com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.DatabaseInner + * object. + * + * @return the inner object. + */ + DatabaseInner innerModel(); + + /** The entirety of the Database definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Database definition stages. */ + interface DefinitionStages { + /** The first stage of the Database definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Database 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 withExistingFlexibleServer(String resourceGroupName, String serverName); + } + /** + * The stage of the Database 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.WithCharset, DefinitionStages.WithCollation { + /** + * Executes the create request. + * + * @return the created resource. + */ + Database create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Database create(Context context); + } + /** The stage of the Database definition 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. + */ + WithCreate withCharset(String charset); + } + /** The stage of the Database definition 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. + */ + WithCreate withCollation(String collation); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Database refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Database refresh(Context context); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/DatabaseListResult.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/DatabaseListResult.java new file mode 100644 index 000000000000..07ad61bf2ba8 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/DatabaseListResult.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.DatabaseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A List of databases. */ +@Fluent +public final class DatabaseListResult { + /* + * 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. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of databases housed in a server. + * + * @param value the value value to set. + * @return the DatabaseListResult object itself. + */ + public DatabaseListResult withValue(List value) { + this.value = 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. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Databases.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Databases.java new file mode 100644 index 000000000000..f61879d42c3a --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Databases.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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 Databases. */ +public interface Databases { + /** + * Deletes a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 databaseName); + + /** + * Deletes a database. + * + * @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. + */ + void delete(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets information about a database. + * + * @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 along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets information about a database. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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. + */ + Database get(String resourceGroupName, String serverName, String databaseName); + + /** + * List all the databases 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 databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the databases 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 databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets information about a database. + * + * @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 information about a database along with {@link Response}. + */ + Database getById(String id); + + /** + * Gets information about a database. + * + * @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 information about a database along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a database. + * + * @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 database. + * + * @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 Database resource. + * + * @param name resource name. + * @return the first stage of the new Database definition. + */ + Database.DefinitionStages.Blank define(String name); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/DelegatedSubnetUsage.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/DelegatedSubnetUsage.java new file mode 100644 index 000000000000..ad4555f56020 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/DelegatedSubnetUsage.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Delegated subnet usage data. */ +@Immutable +public final class DelegatedSubnetUsage { + /* + * Name of the delegated subnet for which IP addresses are in use + */ + @JsonProperty(value = "subnetName", access = JsonProperty.Access.WRITE_ONLY) + private String subnetName; + + /* + * Number of IP addresses used by the delegated subnet + */ + @JsonProperty(value = "usage", access = JsonProperty.Access.WRITE_ONLY) + private Long usage; + + /** Creates an instance of DelegatedSubnetUsage class. */ + public DelegatedSubnetUsage() { + } + + /** + * Get the subnetName property: Name of the delegated subnet for which IP addresses are in use. + * + * @return the subnetName value. + */ + public String subnetName() { + return this.subnetName; + } + + /** + * Get the usage property: Number of IP addresses used by the delegated subnet. + * + * @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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FailoverMode.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FailoverMode.java new file mode 100644 index 000000000000..12c58407ffc8 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FailoverMode.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Failover mode. */ +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 a new instance of FailoverMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FailoverMode() { + } + + /** + * 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); + } + + /** + * Gets known FailoverMode values. + * + * @return known FailoverMode values. + */ + public static Collection values() { + return values(FailoverMode.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FastProvisioningEditionCapability.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FastProvisioningEditionCapability.java new file mode 100644 index 000000000000..7c4bf7230e4c --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FastProvisioningEditionCapability.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The FastProvisioningEditionCapability model. */ +@Immutable +public final class FastProvisioningEditionCapability { + /* + * Fast provisioning supported sku name + */ + @JsonProperty(value = "supportedSku", access = JsonProperty.Access.WRITE_ONLY) + private String supportedSku; + + /* + * Fast provisioning supported storage in Gb + */ + @JsonProperty(value = "supportedStorageGb", access = JsonProperty.Access.WRITE_ONLY) + private Long supportedStorageGb; + + /* + * Fast provisioning supported version + */ + @JsonProperty(value = "supportedServerVersions", access = JsonProperty.Access.WRITE_ONLY) + private String supportedServerVersions; + + /** Creates an instance of FastProvisioningEditionCapability class. */ + public FastProvisioningEditionCapability() { + } + + /** + * Get the supportedSku property: Fast provisioning supported sku name. + * + * @return the supportedSku value. + */ + public String supportedSku() { + return this.supportedSku; + } + + /** + * Get the supportedStorageGb property: Fast provisioning supported storage in Gb. + * + * @return the supportedStorageGb value. + */ + public Long supportedStorageGb() { + return this.supportedStorageGb; + } + + /** + * Get the supportedServerVersions property: Fast provisioning supported version. + * + * @return the supportedServerVersions value. + */ + public String supportedServerVersions() { + return this.supportedServerVersions; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FirewallRule.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FirewallRule.java new file mode 100644 index 000000000000..0c760e51f1cc --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FirewallRule.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.FirewallRuleInner; + +/** An immutable client-side representation of FirewallRule. */ +public interface FirewallRule { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 format. + * + * @return the startIpAddress value. + */ + String startIpAddress(); + + /** + * Gets the endIpAddress property: The end IP address of the server firewall rule. Must be IPv4 format. + * + * @return the endIpAddress value. + */ + String endIpAddress(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner + * com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.FirewallRuleInner + * object. + * + * @return the inner object. + */ + FirewallRuleInner innerModel(); + + /** The entirety of the FirewallRule definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithParentResource, + DefinitionStages.WithStartIpAddress, + DefinitionStages.WithEndIpAddress, + DefinitionStages.WithCreate { + } + /** The FirewallRule definition stages. */ + interface DefinitionStages { + /** The first stage of the FirewallRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the FirewallRule 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. + */ + WithStartIpAddress withExistingFlexibleServer(String resourceGroupName, String serverName); + } + /** The stage of the FirewallRule definition allowing to specify startIpAddress. */ + interface WithStartIpAddress { + /** + * Specifies the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 + * format.. + * + * @param startIpAddress The start IP address of the server firewall rule. Must be IPv4 format. + * @return the next definition stage. + */ + WithEndIpAddress withStartIpAddress(String startIpAddress); + } + /** The stage of the FirewallRule definition allowing to specify endIpAddress. */ + interface WithEndIpAddress { + /** + * Specifies the endIpAddress property: The end IP address of the server firewall rule. Must be IPv4 + * format.. + * + * @param endIpAddress The end IP address of the server firewall rule. Must be IPv4 format. + * @return the next definition stage. + */ + WithCreate withEndIpAddress(String endIpAddress); + } + /** + * The stage of the FirewallRule 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + FirewallRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FirewallRule create(Context context); + } + } + /** + * Begins update for the FirewallRule resource. + * + * @return the stage of resource update. + */ + FirewallRule.Update update(); + + /** The template for FirewallRule update. */ + interface Update extends UpdateStages.WithStartIpAddress, UpdateStages.WithEndIpAddress { + /** + * Executes the update request. + * + * @return the updated resource. + */ + FirewallRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + FirewallRule apply(Context context); + } + /** The FirewallRule update stages. */ + interface UpdateStages { + /** The stage of the FirewallRule update allowing to specify startIpAddress. */ + interface WithStartIpAddress { + /** + * Specifies the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 + * format.. + * + * @param startIpAddress The start IP address of the server firewall rule. Must be IPv4 format. + * @return the next definition stage. + */ + Update withStartIpAddress(String startIpAddress); + } + /** The stage of the FirewallRule update allowing to specify endIpAddress. */ + interface WithEndIpAddress { + /** + * Specifies the endIpAddress property: The end IP address of the server firewall rule. Must be IPv4 + * format.. + * + * @param endIpAddress The end IP address of the server firewall rule. Must be IPv4 format. + * @return the next definition stage. + */ + Update withEndIpAddress(String endIpAddress); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FirewallRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FirewallRule refresh(Context context); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FirewallRuleListResult.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FirewallRuleListResult.java new file mode 100644 index 000000000000..304e11886d0b --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FirewallRuleListResult.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.FirewallRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of firewall rules. */ +@Fluent +public final class FirewallRuleListResult { + /* + * 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. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of firewall rules in a server. + * + * @param value the value value to set. + * @return the FirewallRuleListResult object itself. + */ + public FirewallRuleListResult 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 FirewallRuleListResult object itself. + */ + public FirewallRuleListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FirewallRules.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FirewallRules.java new file mode 100644 index 000000000000..16db292d7220 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FirewallRules.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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 FirewallRules. */ +public interface FirewallRules { + /** + * Deletes a PostgreSQL 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 firewallRuleName); + + /** + * Deletes a PostgreSQL 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. + */ + void delete(String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * 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. + * @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 along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * 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. + * @param firewallRuleName The name of the server firewall 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 represents a server firewall rule. + */ + FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * List all the firewall rules in a given 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 firewall rules as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the firewall rules in a given 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 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. + * + * @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 along with {@link Response}. + */ + FirewallRule getById(String id); + + /** + * List all the firewall rules in a given server. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server firewall rule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a PostgreSQL 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. + */ + void deleteById(String id); + + /** + * Deletes a PostgreSQL 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. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new FirewallRule resource. + * + * @param name resource name. + * @return the first stage of the new FirewallRule definition. + */ + FirewallRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FlexibleServerEditionCapability.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FlexibleServerEditionCapability.java new file mode 100644 index 000000000000..3ad9b5863135 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/FlexibleServerEditionCapability.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Flexible server edition capabilities. */ +@Immutable +public final class FlexibleServerEditionCapability { + /* + * 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; + + /** Creates an instance of FlexibleServerEditionCapability class. */ + public FlexibleServerEditionCapability() { + } + + /** + * 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/GeoRedundantBackupEnum.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/GeoRedundantBackupEnum.java new file mode 100644 index 000000000000..883557edc583 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/GeoRedundantBackupEnum.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** A value indicating whether Geo-Redundant backup is enabled on the server. */ +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 a new instance of GeoRedundantBackupEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public GeoRedundantBackupEnum() { + } + + /** + * 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); + } + + /** + * Gets known GeoRedundantBackupEnum values. + * + * @return known GeoRedundantBackupEnum values. + */ + public static Collection values() { + return values(GeoRedundantBackupEnum.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/GetPrivateDnsZoneSuffixes.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/GetPrivateDnsZoneSuffixes.java new file mode 100644 index 000000000000..d44ac4fb9ef6 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/GetPrivateDnsZoneSuffixes.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private DNS zone suffix in the cloud along with {@link Response}. + */ + Response executeWithResponse(Context context); + + /** + * 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(); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/HighAvailability.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/HighAvailability.java new file mode 100644 index 000000000000..7a96cab90e9c --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/HighAvailability.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** High availability properties of a server. */ +@Fluent +public final class HighAvailability { + /* + * 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; + + /** Creates an instance of HighAvailability class. */ + public HighAvailability() { + } + + /** + * 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/HighAvailabilityMode.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/HighAvailabilityMode.java new file mode 100644 index 000000000000..34d9aefc759a --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/HighAvailabilityMode.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The HA mode for the server. */ +public final class HighAvailabilityMode extends ExpandableStringEnum { + /** Static value Disabled for HighAvailabilityMode. */ + public static final HighAvailabilityMode DISABLED = fromString("Disabled"); + + /** Static value ZoneRedundant for HighAvailabilityMode. */ + public static final HighAvailabilityMode ZONE_REDUNDANT = fromString("ZoneRedundant"); + + /** Static value SameZone for HighAvailabilityMode. */ + public static final HighAvailabilityMode SAME_ZONE = fromString("SameZone"); + + /** + * Creates a new instance of HighAvailabilityMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public HighAvailabilityMode() { + } + + /** + * Creates or finds a HighAvailabilityMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding HighAvailabilityMode. + */ + @JsonCreator + public static HighAvailabilityMode fromString(String name) { + return fromString(name, HighAvailabilityMode.class); + } + + /** + * Gets known HighAvailabilityMode values. + * + * @return known HighAvailabilityMode values. + */ + public static Collection values() { + return values(HighAvailabilityMode.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/HyperscaleNodeEditionCapability.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/HyperscaleNodeEditionCapability.java new file mode 100644 index 000000000000..ad279a35b4f3 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/HyperscaleNodeEditionCapability.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Hyperscale node edition capabilities. */ +@Immutable +public final class HyperscaleNodeEditionCapability { + /* + * Server edition name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The list of editions supported by this server edition. + */ + @JsonProperty(value = "supportedStorageEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedStorageEditions; + + /* + * The list of server versions supported by this server edition. + */ + @JsonProperty(value = "supportedServerVersions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedServerVersions; + + /* + * The list of Node Types supported by this server edition. + */ + @JsonProperty(value = "supportedNodeTypes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedNodeTypes; + + /* + * The status + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** Creates an instance of HyperscaleNodeEditionCapability class. */ + public HyperscaleNodeEditionCapability() { + } + + /** + * Get the name property: Server edition name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedStorageEditions property: The list of editions supported by this server edition. + * + * @return the supportedStorageEditions value. + */ + public List supportedStorageEditions() { + return this.supportedStorageEditions; + } + + /** + * Get the supportedServerVersions property: The list of server versions supported by this server edition. + * + * @return the supportedServerVersions value. + */ + public List supportedServerVersions() { + return this.supportedServerVersions; + } + + /** + * Get the supportedNodeTypes property: The list of Node Types supported by this server edition. + * + * @return the supportedNodeTypes value. + */ + public List supportedNodeTypes() { + return this.supportedNodeTypes; + } + + /** + * Get the status property: The status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedStorageEditions() != null) { + supportedStorageEditions().forEach(e -> e.validate()); + } + if (supportedServerVersions() != null) { + supportedServerVersions().forEach(e -> e.validate()); + } + if (supportedNodeTypes() != null) { + supportedNodeTypes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/IdentityType.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/IdentityType.java new file mode 100644 index 000000000000..6214aa4c72c2 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/IdentityType.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** the types of identities associated with this resource; currently restricted to 'None and UserAssigned'. */ +public final class IdentityType extends ExpandableStringEnum { + /** Static value None for IdentityType. */ + public static final IdentityType NONE = fromString("None"); + + /** Static value UserAssigned for IdentityType. */ + public static final IdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Creates a new instance of IdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IdentityType() { + } + + /** + * 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/LocationBasedCapabilities.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/LocationBasedCapabilities.java new file mode 100644 index 000000000000..94147389a2aa --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/LocationBasedCapabilities.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of LocationBasedCapabilities. */ +public interface LocationBasedCapabilities { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capabilities at specified location in a given subscription as paginated response with {@link + * PagedIterable}. + */ + PagedIterable execute(String 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capabilities at specified location in a given subscription as paginated response with {@link + * PagedIterable}. + */ + PagedIterable execute(String locationName, Context context); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/MaintenanceWindow.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/MaintenanceWindow.java new file mode 100644 index 000000000000..7f78538ea427 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/MaintenanceWindow.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Maintenance window properties of a server. */ +@Fluent +public final class MaintenanceWindow { + /* + * indicates whether custom window is enabled or disabled + */ + @JsonProperty(value = "customWindow") + private String customWindow; + + /* + * start hour for maintenance window + */ + @JsonProperty(value = "startHour") + private Integer startHour; + + /* + * start minute for maintenance window + */ + @JsonProperty(value = "startMinute") + private Integer startMinute; + + /* + * day of week for maintenance window + */ + @JsonProperty(value = "dayOfWeek") + private Integer dayOfWeek; + + /** Creates an instance of MaintenanceWindow class. */ + public MaintenanceWindow() { + } + + /** + * 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/NameAvailability.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/NameAvailability.java new file mode 100644 index 000000000000..089a0ed8c0c1 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/NameAvailability.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.NameAvailabilityInner; + +/** An immutable client-side representation of NameAvailability. */ +public interface NameAvailability { + /** + * Gets the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + CheckNameAvailabilityReason reason(); + + /** + * Gets the message property: Detailed reason why the given name is available. + * + * @return the message value. + */ + String message(); + + /** + * Gets the name property: name of the PostgreSQL server. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: type of the server. + * + * @return the type value. + */ + String type(); + + /** + * Gets the inner + * com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.NameAvailabilityInner + * object. + * + * @return the inner object. + */ + NameAvailabilityInner innerModel(); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Network.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Network.java new file mode 100644 index 000000000000..0dd5faa7e072 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Network.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Network properties of a server. */ +@Fluent +public final class Network { + /* + * public network access is enabled or not + */ + @JsonProperty(value = "publicNetworkAccess", access = JsonProperty.Access.WRITE_ONLY) + private ServerPublicNetworkAccessState publicNetworkAccess; + + /* + * Delegated subnet arm resource id. This is required to be passed during create, in case we want the server to be + * VNET injected, i.e. Private access server. During update, pass this only if we want to update the value for + * Private DNS zone. + */ + @JsonProperty(value = "delegatedSubnetResourceId") + private String delegatedSubnetResourceId; + + /* + * Private dns zone arm resource id. This is required to be passed during create, in case we want the server to be + * VNET injected, i.e. Private access server. During update, pass this only if we want to update the value for + * Private DNS zone. + */ + @JsonProperty(value = "privateDnsZoneArmResourceId") + private String privateDnsZoneArmResourceId; + + /** Creates an instance of Network class. */ + public Network() { + } + + /** + * 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. This is required to be passed + * during create, in case we want the server to be VNET injected, i.e. Private access server. During update, pass + * this only if we want to update the value for Private DNS zone. + * + * @return the delegatedSubnetResourceId value. + */ + public String delegatedSubnetResourceId() { + return this.delegatedSubnetResourceId; + } + + /** + * Set the delegatedSubnetResourceId property: Delegated subnet arm resource id. This is required to be passed + * during create, in case we want the server to be VNET injected, i.e. Private access server. During update, pass + * this only if we want to update the value for Private DNS zone. + * + * @param delegatedSubnetResourceId the delegatedSubnetResourceId value to set. + * @return the Network object itself. + */ + public Network withDelegatedSubnetResourceId(String delegatedSubnetResourceId) { + this.delegatedSubnetResourceId = delegatedSubnetResourceId; + return this; + } + + /** + * Get the privateDnsZoneArmResourceId property: Private dns zone arm resource id. This is required to be passed + * during create, in case we want the server to be VNET injected, i.e. Private access server. During update, pass + * this only if we want to update the value for Private DNS zone. + * + * @return the privateDnsZoneArmResourceId value. + */ + public String privateDnsZoneArmResourceId() { + return this.privateDnsZoneArmResourceId; + } + + /** + * Set the privateDnsZoneArmResourceId property: Private dns zone arm resource id. This is required to be passed + * during create, in case we want the server to be VNET injected, i.e. Private access server. During update, pass + * this only if we want to update the value for Private DNS zone. + * + * @param privateDnsZoneArmResourceId the privateDnsZoneArmResourceId value to set. + * @return the Network object itself. + */ + 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/NodeTypeCapability.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/NodeTypeCapability.java new file mode 100644 index 000000000000..ddb0232a9d53 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/NodeTypeCapability.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** node type capability. */ +@Immutable +public final class NodeTypeCapability { + /* + * note type name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * note type + */ + @JsonProperty(value = "nodeType", access = JsonProperty.Access.WRITE_ONLY) + private String nodeType; + + /* + * The status + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** Creates an instance of NodeTypeCapability class. */ + public NodeTypeCapability() { + } + + /** + * Get the name property: note type name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the nodeType property: note type. + * + * @return the nodeType value. + */ + public String nodeType() { + return this.nodeType; + } + + /** + * Get the status property: The status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Operation.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Operation.java new file mode 100644 index 000000000000..7661699f8d27 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Operation.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** REST API operation definition. */ +@Fluent +public final class Operation { + /* + * The name of the operation being performed on this particular object. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The localized display information for this particular operation or action. + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationDisplay display; + + /* + * Indicates whether the operation is a data action + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /* + * The intended executor of the operation. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private OperationOrigin origin; + + /* + * Additional descriptions for the operation. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map properties; + + /** Creates an instance of Operation class. */ + public Operation() { + } + + /** + * Get the name property: The name of the operation being performed on this particular object. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the display property: The localized display information for this particular operation or action. + * + * @return the display value. + */ + 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. + * + * @return the origin value. + */ + public OperationOrigin origin() { + return this.origin; + } + + /** + * Get the properties property: Additional descriptions for the operation. + * + * @return the properties value. + */ + public Map properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/OperationDisplay.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/OperationDisplay.java new file mode 100644 index 000000000000..40e70e4b6fa7 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/OperationDisplay.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Display metadata associated with the operation. */ +@Immutable +public final class OperationDisplay { + /* + * Operation resource provider name. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * Resource on which the operation is performed. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * Localized friendly name for the operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * Operation description. + */ + @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. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: Resource on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: Localized friendly name for the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: Operation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/OperationListResult.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/OperationListResult.java new file mode 100644 index 000000000000..74fd6942ef0a --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/OperationListResult.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.OperationListResultInner; +import java.util.List; + +/** An immutable client-side representation of OperationListResult. */ +public interface OperationListResult { + /** + * Gets the value property: Collection of available operation details. + * + * @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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.OperationListResultInner + * object. + * + * @return the inner object. + */ + OperationListResultInner innerModel(); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/OperationOrigin.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/OperationOrigin.java new file mode 100644 index 000000000000..1b65b47733b6 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/OperationOrigin.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** 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"); + + /** Static value user for OperationOrigin. */ + public static final OperationOrigin USER = fromString("user"); + + /** Static value system for OperationOrigin. */ + public static final OperationOrigin SYSTEM = fromString("system"); + + /** + * Creates a new instance of OperationOrigin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OperationOrigin() { + } + + /** + * Creates or finds a OperationOrigin from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationOrigin. + */ + @JsonCreator + public static OperationOrigin fromString(String name) { + return fromString(name, OperationOrigin.class); + } + + /** + * Gets known OperationOrigin values. + * + * @return known OperationOrigin values. + */ + public static Collection values() { + return values(OperationOrigin.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Operations.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Operations.java new file mode 100644 index 000000000000..2307894e2ed7 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Operations.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +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 along with {@link Response}. + */ + Response listWithResponse(Context context); + + /** + * Lists all of the available REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations. + */ + OperationListResult list(); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Origin.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Origin.java new file mode 100644 index 000000000000..989672e2dbf1 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Origin.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Backup type. */ +public final class Origin extends ExpandableStringEnum { + /** Static value Full for Origin. */ + public static final Origin FULL = fromString("Full"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/PasswordAuthEnum.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/PasswordAuthEnum.java new file mode 100644 index 000000000000..8f07b3433c79 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/PasswordAuthEnum.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** If Enabled, Password authentication is enabled. */ +public final class PasswordAuthEnum extends ExpandableStringEnum { + /** Static value Enabled for PasswordAuthEnum. */ + public static final PasswordAuthEnum ENABLED = fromString("Enabled"); + + /** Static value Disabled for PasswordAuthEnum. */ + public static final PasswordAuthEnum DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of PasswordAuthEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PasswordAuthEnum() { + } + + /** + * Creates or finds a PasswordAuthEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding PasswordAuthEnum. + */ + @JsonCreator + public static PasswordAuthEnum fromString(String name) { + return fromString(name, PasswordAuthEnum.class); + } + + /** + * Gets known PasswordAuthEnum values. + * + * @return known PasswordAuthEnum values. + */ + public static Collection values() { + return values(PasswordAuthEnum.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/PrincipalType.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/PrincipalType.java new file mode 100644 index 000000000000..accc256eaef0 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/PrincipalType.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The principal type used to represent the type of Active Directory Administrator. */ +public final class PrincipalType extends ExpandableStringEnum { + /** Static value Unknown for PrincipalType. */ + public static final PrincipalType UNKNOWN = fromString("Unknown"); + + /** Static value User for PrincipalType. */ + public static final PrincipalType USER = fromString("User"); + + /** Static value Group for PrincipalType. */ + public static final PrincipalType GROUP = fromString("Group"); + + /** Static value ServicePrincipal for PrincipalType. */ + public static final PrincipalType SERVICE_PRINCIPAL = fromString("ServicePrincipal"); + + /** + * Creates a new instance of PrincipalType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrincipalType() { + } + + /** + * Creates or finds a PrincipalType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrincipalType. + */ + @JsonCreator + public static PrincipalType fromString(String name) { + return fromString(name, PrincipalType.class); + } + + /** + * Gets known PrincipalType values. + * + * @return known PrincipalType values. + */ + public static Collection values() { + return values(PrincipalType.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Replicas.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Replicas.java new file mode 100644 index 000000000000..43a46cc561fb --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ReplicationRole.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ReplicationRole.java new file mode 100644 index 000000000000..a728c8468697 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ReplicationRole.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Used to indicate role of the server in replication set. */ +public final class ReplicationRole extends ExpandableStringEnum { + /** Static value None for ReplicationRole. */ + public static final ReplicationRole NONE = fromString("None"); + + /** Static value Primary for ReplicationRole. */ + public static final ReplicationRole PRIMARY = fromString("Primary"); + + /** Static value AsyncReplica for ReplicationRole. */ + public static final ReplicationRole ASYNC_REPLICA = fromString("AsyncReplica"); + + /** Static value GeoAsyncReplica for ReplicationRole. */ + public static final ReplicationRole GEO_ASYNC_REPLICA = fromString("GeoAsyncReplica"); + + /** + * Creates a new instance of ReplicationRole value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ReplicationRole() { + } + + /** + * Creates or finds a ReplicationRole from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReplicationRole. + */ + @JsonCreator + public static ReplicationRole fromString(String name) { + return fromString(name, ReplicationRole.class); + } + + /** + * Gets known ReplicationRole values. + * + * @return known ReplicationRole values. + */ + public static Collection values() { + return values(ReplicationRole.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/RestartParameter.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/RestartParameter.java new file mode 100644 index 000000000000..4e59415d19c1 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/RestartParameter.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents server restart parameters. */ +@Fluent +public final class RestartParameter { + /* + * Indicates whether to restart the server with failover. + */ + @JsonProperty(value = "restartWithFailover") + private Boolean restartWithFailover; + + /* + * Failover mode. + */ + @JsonProperty(value = "failoverMode") + private FailoverMode failoverMode; + + /** Creates an instance of RestartParameter class. */ + public RestartParameter() { + } + + /** + * 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Server.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Server.java new file mode 100644 index 000000000000..d0c80a4bbc02 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Server.java @@ -0,0 +1,751 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of Server. */ +public interface Server { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sku property: The SKU (pricing tier) of the server. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the identity property: Describes the identity of the application. + * + * @return the identity value. + */ + UserAssignedIdentity identity(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the administratorLogin property: The administrator's login name of a server. Can only be specified when the + * server is being created (and is required for creation). + * + * @return the administratorLogin value. + */ + 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. + * + * @return the version value. + */ + ServerVersion version(); + + /** + * Gets the minorVersion property: The minor version of the server. + * + * @return the minorVersion value. + */ + String minorVersion(); + + /** + * Gets the state property: A state of a server that is visible to user. + * + * @return the state value. + */ + ServerState state(); + + /** + * Gets the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * + * @return the fullyQualifiedDomainName value. + */ + String fullyQualifiedDomainName(); + + /** + * Gets the storage property: Storage properties of a server. + * + * @return the storage value. + */ + Storage storage(); + + /** + * Gets the authConfig property: AuthConfig properties of a server. + * + * @return the authConfig value. + */ + AuthConfig authConfig(); + + /** + * Gets the dataEncryption property: Data encryption properties of a server. + * + * @return the dataEncryption value. + */ + DataEncryption dataEncryption(); + + /** + * Gets the backup property: Backup properties of a server. + * + * @return the backup value. + */ + Backup backup(); + + /** + * Gets the network property: Network properties of a server. This Network property is required to be passed only in + * case you want the server to be Private access server. + * + * @return the network value. + */ + Network network(); + + /** + * Gets the highAvailability property: High availability properties of a server. + * + * @return the highAvailability value. + */ + HighAvailability highAvailability(); + + /** + * Gets the maintenanceWindow property: Maintenance window properties of a server. + * + * @return the maintenanceWindow value. + */ + MaintenanceWindow maintenanceWindow(); + + /** + * Gets the sourceServerResourceId property: The source server resource ID to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'. This property is returned only for Replica + * server. + * + * @return the sourceServerResourceId value. + */ + String sourceServerResourceId(); + + /** + * Gets the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore + * from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore'. + * + * @return the pointInTimeUtc value. + */ + OffsetDateTime pointInTimeUtc(); + + /** + * Gets the availabilityZone property: availability zone information of the server. + * + * @return the availabilityZone value. + */ + String availabilityZone(); + + /** + * Gets the replicationRole property: Replication role of the server. + * + * @return the replicationRole value. + */ + ReplicationRole replicationRole(); + + /** + * Gets the replicaCapacity property: Replicas allowed for a server. + * + * @return the replicaCapacity value. + */ + Integer replicaCapacity(); + + /** + * Gets the createMode property: The mode to create a new PostgreSQL server. + * + * @return the createMode value. + */ + CreateMode createMode(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner + * com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerInner + * object. + * + * @return the inner object. + */ + ServerInner innerModel(); + + /** The entirety of the Server definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Server definition stages. */ + interface DefinitionStages { + /** The first stage of the Server definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Server definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Server definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * 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.WithIdentity, + DefinitionStages.WithAdministratorLogin, + DefinitionStages.WithAdministratorLoginPassword, + DefinitionStages.WithVersion, + DefinitionStages.WithStorage, + DefinitionStages.WithAuthConfig, + DefinitionStages.WithDataEncryption, + DefinitionStages.WithBackup, + DefinitionStages.WithNetwork, + DefinitionStages.WithHighAvailability, + DefinitionStages.WithSourceServerResourceId, + DefinitionStages.WithPointInTimeUtc, + DefinitionStages.WithAvailabilityZone, + DefinitionStages.WithReplicationRole, + DefinitionStages.WithCreateMode { + /** + * Executes the create request. + * + * @return the created resource. + */ + Server create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Server create(Context context); + } + /** The stage of the Server definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Server definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU (pricing tier) of the server.. + * + * @param sku The SKU (pricing tier) of the server. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the Server definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Describes the identity of the application.. + * + * @param identity Describes the identity of the application. + * @return the next definition stage. + */ + WithCreate withIdentity(UserAssignedIdentity 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 authConfig. */ + interface WithAuthConfig { + /** + * Specifies the authConfig property: AuthConfig properties of a server.. + * + * @param authConfig AuthConfig properties of a server. + * @return the next definition stage. + */ + WithCreate withAuthConfig(AuthConfig authConfig); + } + /** The stage of the Server definition allowing to specify dataEncryption. */ + interface WithDataEncryption { + /** + * Specifies the dataEncryption property: Data encryption properties of a server.. + * + * @param dataEncryption Data encryption properties of a server. + * @return the next definition stage. + */ + WithCreate withDataEncryption(DataEncryption dataEncryption); + } + /** 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. This Network property is required to be + * passed only in case you want the server to be Private access server.. + * + * @param network Network properties of a server. This Network property is required to be passed only in + * case you want the server to be Private access server. + * @return the next definition stage. + */ + WithCreate withNetwork(Network network); + } + /** 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' or 'GeoRestore' or 'Replica'. This property is + * returned only for Replica server. + * + * @param sourceServerResourceId The source server resource ID to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'. This property is returned only for + * Replica server. + * @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' or 'GeoRestore'.. + * + * @param pointInTimeUtc Restore point creation time (ISO8601 format), specifying the time to restore from. + * It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore'. + * @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 replicationRole. */ + interface WithReplicationRole { + /** + * Specifies the replicationRole property: Replication role of the server. + * + * @param replicationRole Replication role of the server. + * @return the next definition stage. + */ + WithCreate withReplicationRole(ReplicationRole replicationRole); + } + /** 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); + } + } + /** + * Begins update for the Server resource. + * + * @return the stage of resource update. + */ + Server.Update update(); + + /** The template for Server update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSku, + UpdateStages.WithIdentity, + UpdateStages.WithAdministratorLoginPassword, + UpdateStages.WithVersion, + UpdateStages.WithStorage, + UpdateStages.WithBackup, + UpdateStages.WithHighAvailability, + UpdateStages.WithMaintenanceWindow, + UpdateStages.WithAuthConfig, + UpdateStages.WithDataEncryption, + UpdateStages.WithCreateMode, + UpdateStages.WithReplicationRole, + UpdateStages.WithNetwork { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Server apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Server apply(Context context); + } + /** The Server update stages. */ + interface UpdateStages { + /** The stage of the Server update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Application-specific metadata in the form of key-value pairs.. + * + * @param tags Application-specific metadata in the form of key-value pairs. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the Server update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU (pricing tier) of the server.. + * + * @param sku The SKU (pricing tier) of the server. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + /** The stage of the Server update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Describes the identity of the application.. + * + * @param identity Describes the identity of the application. + * @return the next definition stage. + */ + Update withIdentity(UserAssignedIdentity identity); + } + /** The stage of the Server update allowing to specify administratorLoginPassword. */ + interface WithAdministratorLoginPassword { + /** + * Specifies the administratorLoginPassword property: The password of the administrator login.. + * + * @param administratorLoginPassword The password of the administrator login. + * @return the next definition stage. + */ + Update withAdministratorLoginPassword(String administratorLoginPassword); + } + /** The stage of the Server update allowing to specify version. */ + interface WithVersion { + /** + * Specifies the version property: PostgreSQL Server version.. + * + * @param version PostgreSQL Server version. + * @return the next definition stage. + */ + Update withVersion(ServerVersion version); + } + /** The stage of the Server update 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. + */ + Update withStorage(Storage storage); + } + /** The stage of the Server update 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. + */ + Update withBackup(Backup backup); + } + /** The stage of the Server update 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. + */ + Update withHighAvailability(HighAvailability highAvailability); + } + /** The stage of the Server update allowing to specify maintenanceWindow. */ + interface WithMaintenanceWindow { + /** + * Specifies the maintenanceWindow property: Maintenance window properties of a server.. + * + * @param maintenanceWindow Maintenance window properties of a server. + * @return the next definition stage. + */ + Update withMaintenanceWindow(MaintenanceWindow maintenanceWindow); + } + /** The stage of the Server update allowing to specify authConfig. */ + interface WithAuthConfig { + /** + * Specifies the authConfig property: AuthConfig properties of a server.. + * + * @param authConfig AuthConfig properties of a server. + * @return the next definition stage. + */ + Update withAuthConfig(AuthConfig authConfig); + } + /** The stage of the Server update allowing to specify dataEncryption. */ + interface WithDataEncryption { + /** + * Specifies the dataEncryption property: Data encryption properties of a server.. + * + * @param dataEncryption Data encryption properties of a server. + * @return the next definition stage. + */ + Update withDataEncryption(DataEncryption dataEncryption); + } + /** The stage of the Server update allowing to specify createMode. */ + interface WithCreateMode { + /** + * Specifies the createMode property: The mode to update a new PostgreSQL server.. + * + * @param createMode The mode to update a new PostgreSQL server. + * @return the next definition stage. + */ + Update withCreateMode(CreateModeForUpdate createMode); + } + /** The stage of the Server update allowing to specify replicationRole. */ + interface WithReplicationRole { + /** + * Specifies the replicationRole property: Replication role of the server. + * + * @param replicationRole Replication role of the server. + * @return the next definition stage. + */ + Update withReplicationRole(ReplicationRole replicationRole); + } + /** The stage of the Server update allowing to specify network. */ + interface WithNetwork { + /** + * Specifies the network property: Network properties of a server. These are required to be passed only in + * case if server is a private access server.. + * + * @param network Network properties of a server. These are required to be passed only in case if server is + * a private access server. + * @return the next definition stage. + */ + Update withNetwork(Network network); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Server refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Server refresh(Context context); + + /** + * Restarts a server. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(); + + /** + * 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); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerBackup.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerBackup.java new file mode 100644 index 000000000000..a08443169e84 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerBackup.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerBackupInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ServerBackup. */ +public interface ServerBackup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the backupType property: Backup type. + * + * @return the backupType value. + */ + Origin backupType(); + + /** + * Gets the completedTime property: Backup completed time (ISO8601 format). + * + * @return the completedTime value. + */ + OffsetDateTime completedTime(); + + /** + * Gets the source property: Backup source. + * + * @return the source value. + */ + String source(); + + /** + * Gets the inner + * com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerBackupInner + * object. + * + * @return the inner object. + */ + ServerBackupInner innerModel(); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerBackupListResult.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerBackupListResult.java new file mode 100644 index 000000000000..3c828688c033 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerBackupListResult.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerBackupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server backups. */ +@Fluent +public final class ServerBackupListResult { + /* + * The list of backups of a server. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link used to get the next page of operations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of ServerBackupListResult class. */ + public ServerBackupListResult() { + } + + /** + * Get the value property: The list of backups of a server. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of backups of a server. + * + * @param value the value value to set. + * @return the ServerBackupListResult object itself. + */ + public ServerBackupListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link used to get the next page of operations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of operations. + * + * @param nextLink the nextLink value to set. + * @return the ServerBackupListResult object itself. + */ + public ServerBackupListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerForUpdate.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerForUpdate.java new file mode 100644 index 000000000000..e758e01aec3e --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerForUpdate.java @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerPropertiesForUpdate; +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 { + /* + * The SKU (pricing tier) of the server. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Describes the identity of the application. + */ + @JsonProperty(value = "identity") + private UserAssignedIdentity identity; + + /* + * 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; + + /** Creates an instance of ServerForUpdate class. */ + public ServerForUpdate() { + } + + /** + * 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 identity property: Describes the identity of the application. + * + * @return the identity value. + */ + public UserAssignedIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Describes the identity of the application. + * + * @param identity the identity value to set. + * @return the ServerForUpdate object itself. + */ + public ServerForUpdate withIdentity(UserAssignedIdentity identity) { + this.identity = identity; + 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 version property: PostgreSQL Server version. + * + * @return the version value. + */ + public ServerVersion version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: PostgreSQL Server version. + * + * @param version the version value to set. + * @return the ServerForUpdate object itself. + */ + public ServerForUpdate withVersion(ServerVersion version) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerPropertiesForUpdate(); + } + this.innerProperties().withVersion(version); + 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 authConfig property: AuthConfig properties of a server. + * + * @return the authConfig value. + */ + public AuthConfig authConfig() { + return this.innerProperties() == null ? null : this.innerProperties().authConfig(); + } + + /** + * Set the authConfig property: AuthConfig properties of a server. + * + * @param authConfig the authConfig value to set. + * @return the ServerForUpdate object itself. + */ + public ServerForUpdate withAuthConfig(AuthConfig authConfig) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerPropertiesForUpdate(); + } + this.innerProperties().withAuthConfig(authConfig); + return this; + } + + /** + * Get the dataEncryption property: Data encryption properties of a server. + * + * @return the dataEncryption value. + */ + public DataEncryption dataEncryption() { + return this.innerProperties() == null ? null : this.innerProperties().dataEncryption(); + } + + /** + * Set the dataEncryption property: Data encryption properties of a server. + * + * @param dataEncryption the dataEncryption value to set. + * @return the ServerForUpdate object itself. + */ + public ServerForUpdate withDataEncryption(DataEncryption dataEncryption) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerPropertiesForUpdate(); + } + this.innerProperties().withDataEncryption(dataEncryption); + 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; + } + + /** + * Get the replicationRole property: Replication role of the server. + * + * @return the replicationRole value. + */ + public ReplicationRole replicationRole() { + return this.innerProperties() == null ? null : this.innerProperties().replicationRole(); + } + + /** + * Set the replicationRole property: Replication role of the server. + * + * @param replicationRole the replicationRole value to set. + * @return the ServerForUpdate object itself. + */ + public ServerForUpdate withReplicationRole(ReplicationRole replicationRole) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerPropertiesForUpdate(); + } + this.innerProperties().withReplicationRole(replicationRole); + return this; + } + + /** + * Get the network property: Network properties of a server. These are required to be passed only in case if server + * is a private access server. + * + * @return the network value. + */ + public Network network() { + return this.innerProperties() == null ? null : this.innerProperties().network(); + } + + /** + * Set the network property: Network properties of a server. These are required to be passed only in case if server + * is a private access server. + * + * @param network the network value to set. + * @return the ServerForUpdate object itself. + */ + public ServerForUpdate withNetwork(Network network) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerPropertiesForUpdate(); + } + this.innerProperties().withNetwork(network); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerHAState.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerHAState.java new file mode 100644 index 000000000000..238f982c3c01 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerHAState.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** A state of a HA server that is visible to user. */ +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 a new instance of ServerHAState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ServerHAState() { + } + + /** + * 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); + } + + /** + * Gets known ServerHAState values. + * + * @return known ServerHAState values. + */ + public static Collection values() { + return values(ServerHAState.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerListResult.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerListResult.java new file mode 100644 index 000000000000..265cc23aa83b --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerListResult.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.ServerInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of servers. */ +@Fluent +public final class ServerListResult { + /* + * The list of flexible 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. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of flexible servers. + * + * @param value the value value to set. + * @return the ServerListResult object itself. + */ + public ServerListResult 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 ServerListResult object itself. + */ + public ServerListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerPublicNetworkAccessState.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerPublicNetworkAccessState.java new file mode 100644 index 000000000000..3d9527198f17 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerPublicNetworkAccessState.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** public network access is enabled or not. */ +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 a new instance of ServerPublicNetworkAccessState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ServerPublicNetworkAccessState() { + } + + /** + * 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); + } + + /** + * Gets known ServerPublicNetworkAccessState values. + * + * @return known ServerPublicNetworkAccessState values. + */ + public static Collection values() { + return values(ServerPublicNetworkAccessState.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerState.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerState.java new file mode 100644 index 000000000000..691db67c2da4 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerState.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** 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"); + + /** Static value Dropping for ServerState. */ + public static final ServerState DROPPING = fromString("Dropping"); + + /** 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"); + + /** + * Creates a new instance of ServerState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ServerState() { + } + + /** + * Creates or finds a ServerState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerState. + */ + @JsonCreator + public static ServerState fromString(String name) { + return fromString(name, ServerState.class); + } + + /** + * Gets known ServerState values. + * + * @return known ServerState values. + */ + public static Collection values() { + return values(ServerState.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerVersion.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerVersion.java new file mode 100644 index 000000000000..86e91273f954 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerVersion.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The version of a server. */ +public final class ServerVersion extends ExpandableStringEnum { + /** Static value 14 for ServerVersion. */ + public static final ServerVersion ONE_FOUR = fromString("14"); + + /** Static value 13 for ServerVersion. */ + public static final ServerVersion ONE_THREE = fromString("13"); + + /** Static value 12 for ServerVersion. */ + public static final ServerVersion ONE_TWO = fromString("12"); + + /** Static value 11 for ServerVersion. */ + public static final ServerVersion ONE_ONE = fromString("11"); + + /** + * Creates a new instance of ServerVersion value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ServerVersion() { + } + + /** + * Creates or finds a ServerVersion from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerVersion. + */ + @JsonCreator + public static ServerVersion fromString(String name) { + return fromString(name, ServerVersion.class); + } + + /** + * Gets known ServerVersion values. + * + * @return known ServerVersion values. + */ + public static Collection values() { + return values(ServerVersion.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerVersionCapability.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerVersionCapability.java new file mode 100644 index 000000000000..e9c13e2a504c --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/ServerVersionCapability.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Server version capabilities. */ +@Immutable +public final class ServerVersionCapability { + /* + * server version + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Supported servers versions to upgrade + */ + @JsonProperty(value = "supportedVersionsToUpgrade", access = JsonProperty.Access.WRITE_ONLY) + private List supportedVersionsToUpgrade; + + /* + * The supportedVcores property. + */ + @JsonProperty(value = "supportedVcores", access = JsonProperty.Access.WRITE_ONLY) + private List supportedVcores; + + /* + * The status + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** Creates an instance of ServerVersionCapability class. */ + public ServerVersionCapability() { + } + + /** + * Get the name property: server version. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedVersionsToUpgrade property: Supported servers versions to upgrade. + * + * @return the supportedVersionsToUpgrade value. + */ + public List supportedVersionsToUpgrade() { + return this.supportedVersionsToUpgrade; + } + + /** + * Get the supportedVcores property: The supportedVcores property. + * + * @return the supportedVcores value. + */ + public List supportedVcores() { + return this.supportedVcores; + } + + /** + * Get the status property: The status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedVcores() != null) { + supportedVcores().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Servers.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Servers.java new file mode 100644 index 000000000000..441e8d7afcb0 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Servers.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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 Servers. */ +public interface Servers { + /** + * Deletes 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 deleteByResourceGroup(String resourceGroupName, String serverName); + + /** + * Deletes 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 delete(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 along with {@link Response}. + */ + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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. + */ + Server getByResourceGroup(String resourceGroupName, String serverName); + + /** + * List all the servers in a given resource group. + * + * @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 a list of servers as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all the servers in a given resource group. + * + * @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 a list of servers as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List all the servers in a given subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if 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 list(); + + /** + * List all the servers in a given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * 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. + */ + 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); + + /** + * Gets information about a server. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a server along with {@link Response}. + */ + Server getById(String id); + + /** + * Gets information about a server. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a server along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a server. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a server. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Server resource. + * + * @param name resource name. + * @return the first stage of the new Server definition. + */ + Server.DefinitionStages.Blank define(String name); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Sku.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Sku.java new file mode 100644 index 000000000000..2c5f2ecc1ee7 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Sku.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Sku information related properties of a server. */ +@Fluent +public final class Sku { + /* + * The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The tier of the particular SKU, e.g. Burstable. + */ + @JsonProperty(value = "tier", required = true) + private SkuTier tier; + + /** Creates an instance of Sku class. */ + public Sku() { + } + + /** + * Get the name property: The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. + * + * @param name the name value to set. + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: The tier of the particular SKU, e.g. Burstable. + * + * @return the tier value. + */ + public SkuTier tier() { + return this.tier; + } + + /** + * Set the tier property: The tier of the particular SKU, e.g. Burstable. + * + * @param tier the tier value to set. + * @return the Sku object itself. + */ + public Sku withTier(SkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/SkuTier.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/SkuTier.java new file mode 100644 index 000000000000..c21ae0b6e9a6 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/SkuTier.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The tier of the particular SKU, e.g. Burstable. */ +public final class SkuTier extends ExpandableStringEnum { + /** Static value Burstable for SkuTier. */ + public static final SkuTier BURSTABLE = fromString("Burstable"); + + /** Static value GeneralPurpose for SkuTier. */ + public static final SkuTier GENERAL_PURPOSE = fromString("GeneralPurpose"); + + /** Static value MemoryOptimized for SkuTier. */ + public static final SkuTier MEMORY_OPTIMIZED = fromString("MemoryOptimized"); + + /** + * Creates a new instance of SkuTier value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SkuTier() { + } + + /** + * Creates or finds a SkuTier from its string representation. + * + * @param name a name to look for. + * @return the corresponding SkuTier. + */ + @JsonCreator + public static SkuTier fromString(String name) { + return fromString(name, SkuTier.class); + } + + /** + * Gets known SkuTier values. + * + * @return known SkuTier values. + */ + public static Collection values() { + return values(SkuTier.class); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Storage.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Storage.java new file mode 100644 index 000000000000..fa1f61f87b93 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/Storage.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Storage properties of a server. */ +@Fluent +public final class Storage { + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "storageSizeGB") + private Integer storageSizeGB; + + /** Creates an instance of Storage class. */ + public Storage() { + } + + /** + * 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/StorageEditionCapability.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/StorageEditionCapability.java new file mode 100644 index 000000000000..978f0194ec56 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/StorageEditionCapability.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** storage edition capability. */ +@Immutable +public final class StorageEditionCapability { + /* + * 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; + + /** Creates an instance of StorageEditionCapability class. */ + public StorageEditionCapability() { + } + + /** + * 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/StorageMBCapability.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/StorageMBCapability.java new file mode 100644 index 000000000000..afb34eb11c12 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/StorageMBCapability.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** storage size in MB capability. */ +@Immutable +public final class StorageMBCapability { + /* + * storage MB name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * supported IOPS + */ + @JsonProperty(value = "supportedIops", access = JsonProperty.Access.WRITE_ONLY) + private Long supportedIops; + + /* + * storage size in MB + */ + @JsonProperty(value = "storageSizeMB", access = JsonProperty.Access.WRITE_ONLY) + private Long storageSizeMB; + + /* + * The supportedUpgradableTierList property. + */ + @JsonProperty(value = "supportedUpgradableTierList", access = JsonProperty.Access.WRITE_ONLY) + private List supportedUpgradableTierList; + + /* + * The status + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** Creates an instance of StorageMBCapability class. */ + public StorageMBCapability() { + } + + /** + * Get the name property: storage MB name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedIops property: supported IOPS. + * + * @return the supportedIops value. + */ + public Long supportedIops() { + return this.supportedIops; + } + + /** + * Get the storageSizeMB property: storage size in MB. + * + * @return the storageSizeMB value. + */ + public Long storageSizeMB() { + return this.storageSizeMB; + } + + /** + * Get the supportedUpgradableTierList property: The supportedUpgradableTierList property. + * + * @return the supportedUpgradableTierList value. + */ + public List supportedUpgradableTierList() { + return this.supportedUpgradableTierList; + } + + /** + * Get the status property: The status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedUpgradableTierList() != null) { + supportedUpgradableTierList().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/StorageTierCapability.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/StorageTierCapability.java new file mode 100644 index 000000000000..306f0c42b092 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/StorageTierCapability.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The StorageTierCapability model. */ +@Immutable +public final class StorageTierCapability { + /* + * Name to represent Storage tier capability + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Storage tier name + */ + @JsonProperty(value = "tierName", access = JsonProperty.Access.WRITE_ONLY) + private String tierName; + + /* + * Supported IOPS for this storage tier + */ + @JsonProperty(value = "iops", access = JsonProperty.Access.WRITE_ONLY) + private Long iops; + + /* + * Indicates if this is a baseline storage tier or not + */ + @JsonProperty(value = "isBaseline", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isBaseline; + + /* + * Status os this storage tier + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** Creates an instance of StorageTierCapability class. */ + public StorageTierCapability() { + } + + /** + * Get the name property: Name to represent Storage tier capability. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the tierName property: Storage tier name. + * + * @return the tierName value. + */ + public String tierName() { + return this.tierName; + } + + /** + * Get the iops property: Supported IOPS for this storage tier. + * + * @return the iops value. + */ + public Long iops() { + return this.iops; + } + + /** + * Get the isBaseline property: Indicates if this is a baseline storage tier or not. + * + * @return the isBaseline value. + */ + public Boolean isBaseline() { + return this.isBaseline; + } + + /** + * Get the status property: Status os this storage tier. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/UserAssignedIdentity.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..6b5d21f3080c --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/UserAssignedIdentity.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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; + +/** Information describing the identities associated with this application. */ +@Fluent +public final class UserAssignedIdentity { + /* + * represents user assigned identities map. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /* + * the types of identities associated with this resource; currently restricted to 'None and UserAssigned' + */ + @JsonProperty(value = "type", required = true) + private IdentityType type; + + /* + * Tenant id of the server. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** Creates an instance of UserAssignedIdentity class. */ + public UserAssignedIdentity() { + } + + /** + * Get the userAssignedIdentities property: represents user assigned identities map. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: represents user assigned identities map. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the UserAssignedIdentity object itself. + */ + public UserAssignedIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Get the type property: the types of identities associated with this resource; currently restricted to 'None and + * UserAssigned'. + * + * @return the type value. + */ + public IdentityType type() { + return this.type; + } + + /** + * Set the type property: the types of identities associated with this resource; currently restricted to 'None and + * UserAssigned'. + * + * @param type the type value to set. + * @return the UserAssignedIdentity object itself. + */ + public UserAssignedIdentity withType(IdentityType type) { + this.type = type; + return this; + } + + /** + * Get the tenantId property: Tenant id of the server. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model UserAssignedIdentity")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(UserAssignedIdentity.class); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/UserIdentity.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/UserIdentity.java new file mode 100644 index 000000000000..16c10907aaec --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/UserIdentity.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a single user-assigned identity associated with the application. */ +@Fluent +public final class UserIdentity { + /* + * the object identifier of the Service Principal which this identity represents. + */ + @JsonProperty(value = "principalId") + private String principalId; + + /* + * the client identifier of the Service Principal which this identity represents. + */ + @JsonProperty(value = "clientId") + private String clientId; + + /** Creates an instance of UserIdentity class. */ + public UserIdentity() { + } + + /** + * Get the principalId property: the object identifier of the Service Principal which this identity represents. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: the object identifier of the Service Principal which this identity represents. + * + * @param principalId the principalId value to set. + * @return the UserIdentity object itself. + */ + public UserIdentity withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the clientId property: the client identifier of the Service Principal which this identity represents. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId property: the client identifier of the Service Principal which this identity represents. + * + * @param clientId the clientId value to set. + * @return the UserIdentity object itself. + */ + public UserIdentity withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/VcoreCapability.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/VcoreCapability.java new file mode 100644 index 000000000000..fc7caa9c17d2 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/VcoreCapability.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Vcores capability. */ +@Immutable +public final class VcoreCapability { + /* + * vCore name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * supported vCores + */ + @JsonProperty(value = "vCores", access = JsonProperty.Access.WRITE_ONLY) + private Long vCores; + + /* + * supported IOPS + */ + @JsonProperty(value = "supportedIops", access = JsonProperty.Access.WRITE_ONLY) + private Long supportedIops; + + /* + * supported memory per vCore in MB + */ + @JsonProperty(value = "supportedMemoryPerVcoreMB", access = JsonProperty.Access.WRITE_ONLY) + private Long supportedMemoryPerVcoreMB; + + /* + * The status + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** Creates an instance of VcoreCapability class. */ + public VcoreCapability() { + } + + /** + * Get the name property: vCore name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the vCores property: supported vCores. + * + * @return the vCores value. + */ + public Long vCores() { + return this.vCores; + } + + /** + * Get the supportedIops property: supported IOPS. + * + * @return the supportedIops value. + */ + public Long supportedIops() { + return this.supportedIops; + } + + /** + * Get the supportedMemoryPerVcoreMB property: supported memory per vCore in MB. + * + * @return the supportedMemoryPerVcoreMB value. + */ + public Long supportedMemoryPerVcoreMB() { + return this.supportedMemoryPerVcoreMB; + } + + /** + * Get the status property: The status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/VirtualNetworkSubnetUsageParameter.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/VirtualNetworkSubnetUsageParameter.java new file mode 100644 index 000000000000..97dd0c34e2a1 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/VirtualNetworkSubnetUsageParameter.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Virtual network subnet usage parameter. */ +@Fluent +public final class VirtualNetworkSubnetUsageParameter { + /* + * Virtual network resource id. + */ + @JsonProperty(value = "virtualNetworkArmResourceId") + private String virtualNetworkArmResourceId; + + /** Creates an instance of VirtualNetworkSubnetUsageParameter class. */ + public VirtualNetworkSubnetUsageParameter() { + } + + /** + * 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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/VirtualNetworkSubnetUsageResult.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/VirtualNetworkSubnetUsageResult.java new file mode 100644 index 000000000000..099cf9c7211e --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/VirtualNetworkSubnetUsageResult.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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 location property: location of the delegated subnet usage. + * + * @return the location value. + */ + String location(); + + /** + * Gets the subscriptionId property: subscriptionId of the delegated subnet usage. + * + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * Gets the inner + * com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner + * object. + * + * @return the inner object. + */ + VirtualNetworkSubnetUsageResultInner innerModel(); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/VirtualNetworkSubnetUsages.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/VirtualNetworkSubnetUsages.java new file mode 100644 index 000000000000..d643b3ee2405 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/VirtualNetworkSubnetUsages.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of VirtualNetworkSubnetUsages. */ +public interface VirtualNetworkSubnetUsages { + /** + * Get virtual network subnet usage for a given vNet resource id. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual network subnet usage for a given vNet resource id along with {@link Response}. + */ + Response executeWithResponse( + String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context); + + /** + * Get virtual network subnet usage for a given vNet resource id. + * + * @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 com.azure.core.management.exception.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. + */ + VirtualNetworkSubnetUsageResult execute(String locationName, VirtualNetworkSubnetUsageParameter parameters); +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/package-info.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/package-info.java new file mode 100644 index 000000000000..0fcc535dd995 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for PostgreSqlManagementClient. 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 com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/package-info.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/package-info.java new file mode 100644 index 000000000000..113c6ad1dd34 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for PostgreSqlManagementClient. 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 com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver; diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/module-info.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/module-info.java new file mode 100644 index 000000000000..f78da7adb2dd --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver; + exports com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent; + exports com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models; + exports com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models; + + opens com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/AdministratorsCreateSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/AdministratorsCreateSamples.java new file mode 100644 index 000000000000..cc4921680c3c --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/AdministratorsCreateSamples.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.PrincipalType; + +/** Samples for Administrators Create. */ +public final class AdministratorsCreateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/AdministratorAdd.json + */ + /** + * Sample code: Adds an Active DIrectory Administrator for the server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void addsAnActiveDIrectoryAdministratorForTheServer( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .administrators() + .define("oooooooo-oooo-oooo-oooo-oooooooooooo") + .withExistingFlexibleServer("testrg", "testserver") + .withPrincipalType(PrincipalType.USER) + .withPrincipalName("testuser1@microsoft.com") + .withTenantId("tttttttt-tttt-tttt-tttt-tttttttttttt") + .create(); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/AdministratorsDeleteSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/AdministratorsDeleteSamples.java new file mode 100644 index 000000000000..683fa5b9de51 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/AdministratorsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Administrators Delete. */ +public final class AdministratorsDeleteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/AdministratorDelete.json + */ + /** + * Sample code: AdministratorDelete. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void administratorDelete( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .administrators() + .delete("testrg", "testserver", "oooooooo-oooo-oooo-oooo-oooooooooooo", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/AdministratorsGetSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/AdministratorsGetSamples.java new file mode 100644 index 000000000000..203ad3ee26c8 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/AdministratorsGetSamples.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Administrators Get. */ +public final class AdministratorsGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/AdministratorGet.json + */ + /** + * Sample code: ServerGet. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverGet( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .administrators() + .getWithResponse( + "testrg", "pgtestsvc1", "oooooooo-oooo-oooo-oooo-oooooooooooo", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/AdministratorsListByServerSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/AdministratorsListByServerSamples.java new file mode 100644 index 000000000000..45675eabe72d --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/AdministratorsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Administrators ListByServer. */ +public final class AdministratorsListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/AdministratorsListByServer.json + */ + /** + * Sample code: AdministratorsListByServer. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void administratorsListByServer( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.administrators().listByServer("testrg", "pgtestsvc1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/BackupsGetSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/BackupsGetSamples.java new file mode 100644 index 000000000000..99a78bb684b4 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/BackupsGetSamples.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Backups Get. */ +public final class BackupsGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/BackupGet.json + */ + /** + * Sample code: Get a backup for a server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getABackupForAServer( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .backups() + .getWithResponse( + "TestGroup", "postgresqltestserver", "daily_20210615T160516", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/BackupsListByServerSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/BackupsListByServerSamples.java new file mode 100644 index 000000000000..2db4544baf56 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/BackupsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Backups ListByServer. */ +public final class BackupsListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/BackupListByServer.json + */ + /** + * Sample code: List backups for a server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void listBackupsForAServer( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.backups().listByServer("TestGroup", "postgresqltestserver", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/CheckNameAvailabilityExecuteSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/CheckNameAvailabilityExecuteSamples.java new file mode 100644 index 000000000000..6aae48882c93 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/CheckNameAvailabilityExecuteSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilityRequest; + +/** Samples for CheckNameAvailability Execute. */ +public final class CheckNameAvailabilityExecuteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/CheckNameAvailability.json + */ + /** + * Sample code: NameAvailability. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void nameAvailability( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .checkNameAvailabilities() + .executeWithResponse( + new CheckNameAvailabilityRequest() + .withName("name1") + .withType("Microsoft.DBforPostgreSQL/flexibleServers"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/CheckNameAvailabilityWithLocationExecuteSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/CheckNameAvailabilityWithLocationExecuteSamples.java new file mode 100644 index 000000000000..c5dc047cbac3 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/CheckNameAvailabilityWithLocationExecuteSamples.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CheckNameAvailabilityRequest; + +/** Samples for CheckNameAvailabilityWithLocation Execute. */ +public final class CheckNameAvailabilityWithLocationExecuteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/CheckNameAvailabilityLocationBased.json + */ + /** + * Sample code: NameAvailability. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void nameAvailability( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .checkNameAvailabilityWithLocations() + .executeWithResponse( + "westus", + new CheckNameAvailabilityRequest() + .withName("name1") + .withType("Microsoft.DBforPostgreSQL/flexibleServers"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ConfigurationsGetSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ConfigurationsGetSamples.java new file mode 100644 index 000000000000..4669c2f0f183 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ConfigurationsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Configurations Get. */ +public final class ConfigurationsGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ConfigurationGet.json + */ + /** + * Sample code: ConfigurationGet. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void configurationGet( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .configurations() + .getWithResponse("testrg", "testserver", "array_nulls", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ConfigurationsListByServerSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ConfigurationsListByServerSamples.java new file mode 100644 index 000000000000..194f50a3ade1 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ConfigurationsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Configurations ListByServer. */ +public final class ConfigurationsListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ConfigurationListByServer.json + */ + /** + * Sample code: ConfigurationList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void configurationList( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.configurations().listByServer("testrg", "testserver", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ConfigurationsPutSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ConfigurationsPutSamples.java new file mode 100644 index 000000000000..0f21d7c3d6a2 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ConfigurationsPutSamples.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Configurations Put. */ +public final class ConfigurationsPutSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ConfigurationUpdate.json + */ + /** + * Sample code: Update a user configuration. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void updateAUserConfiguration( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .configurations() + .define("event_scheduler") + .withExistingFlexibleServer("testrg", "testserver") + .withValue("on") + .withSource("user-override") + .create(); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ConfigurationsUpdateSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ConfigurationsUpdateSamples.java new file mode 100644 index 000000000000..86a96123e475 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ConfigurationsUpdateSamples.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Configuration; + +/** Samples for Configurations Update. */ +public final class ConfigurationsUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ConfigurationUpdate.json + */ + /** + * Sample code: Update a user configuration. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void updateAUserConfiguration( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + Configuration resource = + manager + .configurations() + .getWithResponse("testrg", "testserver", "event_scheduler", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withValue("on").withSource("user-override").apply(); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/DatabasesCreateSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/DatabasesCreateSamples.java new file mode 100644 index 000000000000..51fb9609021a --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/DatabasesCreateSamples.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Databases Create. */ +public final class DatabasesCreateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/DatabaseCreate.json + */ + /** + * Sample code: Create a database. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createADatabase( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .databases() + .define("db1") + .withExistingFlexibleServer("TestGroup", "testserver") + .withCharset("utf8") + .withCollation("en_US.utf8") + .create(); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/DatabasesDeleteSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/DatabasesDeleteSamples.java new file mode 100644 index 000000000000..f76d53e31a6b --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/DatabasesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Databases Delete. */ +public final class DatabasesDeleteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/DatabaseDelete.json + */ + /** + * Sample code: Delete a database. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void deleteADatabase( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.databases().delete("TestGroup", "testserver", "db1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/DatabasesGetSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/DatabasesGetSamples.java new file mode 100644 index 000000000000..ee1e64875bb3 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/DatabasesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Databases Get. */ +public final class DatabasesGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/DatabaseGet.json + */ + /** + * Sample code: Get a database. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getADatabase( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.databases().getWithResponse("TestGroup", "testserver", "db1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/DatabasesListByServerSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/DatabasesListByServerSamples.java new file mode 100644 index 000000000000..92f9fa81e348 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/DatabasesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Databases ListByServer. */ +public final class DatabasesListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/DatabasesListByServer.json + */ + /** + * Sample code: List databases in a server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void listDatabasesInAServer( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.databases().listByServer("TestGroup", "testserver", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/FirewallRulesCreateOrUpdateSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/FirewallRulesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..3ab79ff3ba33 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/FirewallRulesCreateOrUpdateSamples.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for FirewallRules CreateOrUpdate. */ +public final class FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/FirewallRuleCreate.json + */ + /** + * Sample code: FirewallRuleCreate. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void firewallRuleCreate( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .firewallRules() + .define("rule1") + .withExistingFlexibleServer("testrg", "testserver") + .withStartIpAddress("0.0.0.0") + .withEndIpAddress("255.255.255.255") + .create(); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/FirewallRulesDeleteSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/FirewallRulesDeleteSamples.java new file mode 100644 index 000000000000..e9ca3bc75c75 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/FirewallRulesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for FirewallRules Delete. */ +public final class FirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/FirewallRuleDelete.json + */ + /** + * Sample code: FirewallRuleDelete. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void firewallRuleDelete( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.firewallRules().delete("testrg", "testserver", "rule1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/FirewallRulesGetSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/FirewallRulesGetSamples.java new file mode 100644 index 000000000000..13d208ccd79b --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/FirewallRulesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for FirewallRules Get. */ +public final class FirewallRulesGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/FirewallRuleGet.json + */ + /** + * Sample code: FirewallRuleList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void firewallRuleList( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.firewallRules().getWithResponse("testrg", "testserver", "rule1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/FirewallRulesListByServerSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/FirewallRulesListByServerSamples.java new file mode 100644 index 000000000000..9d55efa91b37 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/FirewallRulesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for FirewallRules ListByServer. */ +public final class FirewallRulesListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/FirewallRuleListByServer.json + */ + /** + * Sample code: FirewallRuleList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void firewallRuleList( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.firewallRules().listByServer("testrg", "testserver", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/GetPrivateDnsZoneSuffixExecuteSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/GetPrivateDnsZoneSuffixExecuteSamples.java new file mode 100644 index 000000000000..f747e5b949cc --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/GetPrivateDnsZoneSuffixExecuteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for GetPrivateDnsZoneSuffix Execute. */ +public final class GetPrivateDnsZoneSuffixExecuteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/GetPrivateDnsZoneSuffix.json + */ + /** + * Sample code: GetPrivateDnsZoneSuffix. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getPrivateDnsZoneSuffix( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.getPrivateDnsZoneSuffixes().executeWithResponse(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/LocationBasedCapabilitiesExecuteSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/LocationBasedCapabilitiesExecuteSamples.java new file mode 100644 index 000000000000..996cf52e7145 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/LocationBasedCapabilitiesExecuteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for LocationBasedCapabilities Execute. */ +public final class LocationBasedCapabilitiesExecuteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/CapabilitiesByLocation.json + */ + /** + * Sample code: CapabilitiesList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void capabilitiesList( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.locationBasedCapabilities().execute("westus", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/OperationsListSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/OperationsListSamples.java new file mode 100644 index 000000000000..05d78f66d3fd --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/OperationList.json + */ + /** + * Sample code: OperationList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void operationList( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.operations().listWithResponse(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ReplicasListByServerSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ReplicasListByServerSamples.java new file mode 100644 index 000000000000..28a875f4baa8 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ReplicasListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Replicas ListByServer. */ +public final class ReplicasListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ReplicasListByServer.json + */ + /** + * Sample code: ReplicasListByServer. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void replicasListByServer( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.replicas().listByServer("testrg", "sourcepgservername", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersCreateSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersCreateSamples.java new file mode 100644 index 000000000000..bbe7adfca245 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersCreateSamples.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ActiveDirectoryAuthEnum; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ArmServerKeyType; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.AuthConfig; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Backup; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CreateMode; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.DataEncryption; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.GeoRedundantBackupEnum; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.HighAvailability; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.HighAvailabilityMode; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.IdentityType; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Network; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.PasswordAuthEnum; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerVersion; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Sku; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.SkuTier; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Storage; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.UserAssignedIdentity; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.UserIdentity; +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/postgresql-flexibleserver/stable/2022-12-01/examples/ServerCreateWithDataEncryptionEnabled.json + */ + /** + * Sample code: ServerCreateWithDataEncryptionEnabled. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverCreateWithDataEncryptionEnabled( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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)) + .withIdentity( + new UserAssignedIdentity() + .withUserAssignedIdentities( + mapOf( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", + new UserIdentity())) + .withType(IdentityType.USER_ASSIGNED)) + .withAdministratorLogin("cloudsa") + .withAdministratorLoginPassword("password") + .withVersion(ServerVersion.ONE_TWO) + .withStorage(new Storage().withStorageSizeGB(512)) + .withDataEncryption( + new DataEncryption() + .withPrimaryKeyUri("fakeTokenPlaceholder") + .withPrimaryUserAssignedIdentityId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity") + .withType(ArmServerKeyType.AZURE_KEY_VAULT)) + .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) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerCreateGeoRestore.json + */ + /** + * Sample code: Create a database as a geo-restore in geo-paired location. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createADatabaseAsAGeoRestoreInGeoPairedLocation( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .servers() + .define("pgtestsvc5geo") + .withRegion("eastus") + .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.GEO_RESTORE) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerCreate.json + */ + /** + * Sample code: Create a new server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createANewServer( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerCreateWithAadAuthEnabled.json + */ + /** + * Sample code: Create a new server with active directory authentication enabled. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createANewServerWithActiveDirectoryAuthenticationEnabled( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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)) + .withAuthConfig( + new AuthConfig() + .withActiveDirectoryAuth(ActiveDirectoryAuthEnum.ENABLED) + .withPasswordAuth(PasswordAuthEnum.ENABLED) + .withTenantId("tttttt-tttt-tttt-tttt-tttttttttttt")) + .withDataEncryption(new DataEncryption().withType(ArmServerKeyType.SYSTEM_MANAGED)) + .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) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerCreateReplica.json + */ + /** + * Sample code: ServerCreateReplica. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverCreateReplica( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .servers() + .define("pgtestsvc5rep") + .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.REPLICA) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.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(); + } + + @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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersDeleteSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersDeleteSamples.java new file mode 100644 index 000000000000..e2f6a7a75923 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Servers Delete. */ +public final class ServersDeleteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerDelete.json + */ + /** + * Sample code: ServerDelete. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverDelete( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.servers().delete("testrg", "testserver", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersGetByResourceGroupSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersGetByResourceGroupSamples.java new file mode 100644 index 000000000000..4be33481e9cd --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersGetByResourceGroupSamples.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Servers GetByResourceGroup. */ +public final class ServersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerGet.json + */ + /** + * Sample code: ServerGet. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverGet( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc1", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerGetWithVnet.json + */ + /** + * Sample code: ServerGetWithVnet. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverGetWithVnet( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersListByResourceGroupSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersListByResourceGroupSamples.java new file mode 100644 index 000000000000..54d201d6c1bd --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersListByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Servers ListByResourceGroup. */ +public final class ServersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerListByResourceGroup.json + */ + /** + * Sample code: ServerListByResourceGroup. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverListByResourceGroup( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.servers().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersListSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersListSamples.java new file mode 100644 index 000000000000..d733e38d674f --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Servers List. */ +public final class ServersListSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerList.json + */ + /** + * Sample code: ServerList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverList( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.servers().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersRestartSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersRestartSamples.java new file mode 100644 index 000000000000..6e5bc73081dd --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersRestartSamples.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.FailoverMode; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.RestartParameter; + +/** Samples for Servers Restart. */ +public final class ServersRestartSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerRestart.json + */ + /** + * Sample code: ServerRestart. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverRestart( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.servers().restart("testrg", "testserver", null, com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerRestartWithFailover.json + */ + /** + * Sample code: ServerRestartWithFailover. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverRestartWithFailover( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .servers() + .restart( + "testrg", + "testserver", + new RestartParameter().withRestartWithFailover(true).withFailoverMode(FailoverMode.FORCED_FAILOVER), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersStartSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersStartSamples.java new file mode 100644 index 000000000000..23e0281886ae --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersStartSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Servers Start. */ +public final class ServersStartSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerStart.json + */ + /** + * Sample code: ServerStart. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverStart( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.servers().start("testrg", "testserver", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersStopSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersStopSamples.java new file mode 100644 index 000000000000..1cab33f52984 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersStopSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +/** Samples for Servers Stop. */ +public final class ServersStopSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerStop.json + */ + /** + * Sample code: ServerStop. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverStop( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager.servers().stop("testrg", "testserver", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersUpdateSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersUpdateSamples.java new file mode 100644 index 000000000000..ad74eab5e695 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/ServersUpdateSamples.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ActiveDirectoryAuthEnum; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ArmServerKeyType; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.AuthConfig; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Backup; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.CreateModeForUpdate; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.DataEncryption; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.IdentityType; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.PasswordAuthEnum; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Server; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.ServerVersion; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Sku; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.SkuTier; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.Storage; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.UserAssignedIdentity; +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.UserIdentity; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Servers Update. */ +public final class ServersUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerUpdateWithAadAuthEnabled.json + */ + /** + * Sample code: ServerUpdateWithAadAuthEnabled. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverUpdateWithAadAuthEnabled( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + Server resource = + manager + .servers() + .getByResourceGroupWithResponse("TestGroup", "pgtestsvc4", com.azure.core.util.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)) + .withAuthConfig( + new AuthConfig() + .withActiveDirectoryAuth(ActiveDirectoryAuthEnum.ENABLED) + .withPasswordAuth(PasswordAuthEnum.ENABLED) + .withTenantId("tttttt-tttt-tttt-tttt-tttttttttttt")) + .withCreateMode(CreateModeForUpdate.UPDATE) + .apply(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerUpdateWithDataEncryptionEnabled.json + */ + /** + * Sample code: ServerUpdateWithDataEncryptionEnabled. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverUpdateWithDataEncryptionEnabled( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + Server resource = + manager + .servers() + .getByResourceGroupWithResponse("TestGroup", "pgtestsvc4", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("Standard_D8s_v3").withTier(SkuTier.GENERAL_PURPOSE)) + .withIdentity( + new UserAssignedIdentity() + .withUserAssignedIdentities( + mapOf( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", + new UserIdentity())) + .withType(IdentityType.USER_ASSIGNED)) + .withAdministratorLoginPassword("newpassword") + .withStorage(new Storage().withStorageSizeGB(1024)) + .withBackup(new Backup().withBackupRetentionDays(20)) + .withDataEncryption( + new DataEncryption() + .withPrimaryKeyUri("fakeTokenPlaceholder") + .withPrimaryUserAssignedIdentityId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity") + .withType(ArmServerKeyType.AZURE_KEY_VAULT)) + .withCreateMode(CreateModeForUpdate.UPDATE) + .apply(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerUpdate.json + */ + /** + * Sample code: ServerUpdate. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverUpdate( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + Server resource = + manager + .servers() + .getByResourceGroupWithResponse("TestGroup", "pgtestsvc4", com.azure.core.util.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/postgresql-flexibleserver/stable/2022-12-01/examples/ServerUpdateWithMajorVersionUpgrade.json + */ + /** + * Sample code: ServerUpdateWithMajorVersionUpgrade. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverUpdateWithMajorVersionUpgrade( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + Server resource = + manager + .servers() + .getByResourceGroupWithResponse("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withVersion(ServerVersion.ONE_FOUR).withCreateMode(CreateModeForUpdate.UPDATE).apply(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/ServerUpdateWithCustomerMaintenanceWindow.json + */ + /** + * Sample code: ServerUpdateWithCustomerMaintenanceWindow. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverUpdateWithCustomerMaintenanceWindow( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + Server resource = + manager + .servers() + .getByResourceGroupWithResponse("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withMaintenanceWindow( + new MaintenanceWindow() + .withCustomWindow("Enabled") + .withStartHour(8) + .withStartMinute(0) + .withDayOfWeek(0)) + .withCreateMode(CreateModeForUpdate.UPDATE) + .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/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/VirtualNetworkSubnetUsageExecuteSamples.java b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/VirtualNetworkSubnetUsageExecuteSamples.java new file mode 100644 index 000000000000..7a9a0ac0990b --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/generated/VirtualNetworkSubnetUsageExecuteSamples.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.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.generated; + +import com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; + +/** Samples for VirtualNetworkSubnetUsage Execute. */ +public final class VirtualNetworkSubnetUsageExecuteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/postgresql-flexibleserver/stable/2022-12-01/examples/VirtualNetworkSubnetUsage.json + */ + /** + * Sample code: VirtualNetworkSubnetUsageList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void virtualNetworkSubnetUsageList( + com.azure.resourcemanager.postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver.PostgreSqlManager + manager) { + manager + .virtualNetworkSubnetUsages() + .executeWithResponse( + "westus", + new VirtualNetworkSubnetUsageParameter() + .withVirtualNetworkArmResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/testvnet"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/ci.yml b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/ci.yml new file mode 100644 index 000000000000..9cdc5d1397bf --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/ci.yml + - sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/ + exclude: + - sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/pom.xml + - sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/ci.yml + - sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/ + exclude: + - sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/pom.xml + - sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/pom.xml + +parameters: + - name: release_azureresourcemanagerpostgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver + displayName: azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerpostgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver + releaseInBatch: ${{ parameters.release_azureresourcemanagerpostgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver }} diff --git a/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/pom.xml b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/pom.xml new file mode 100644 index 000000000000..619c16186fc8 --- /dev/null +++ b/sdk/postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver-service + pom + 1.0.0 + + + azure-resourcemanager-postgresqlmicrosoftdbforpostgresqlpostgresqlflexibleserver + +