diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 8e04955187aa6..9fd396b200a03 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -324,6 +324,7 @@ com.azure.resourcemanager:azure-resourcemanager-storagepool;1.0.0-beta.1;1.0.0-b com.azure.resourcemanager:azure-resourcemanager-dataprotection;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-desktopvirtualization;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-loadtestservice;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-postgresqlhsc;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.0.0 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current diff --git a/pom.xml b/pom.xml index bf7a714e06c42..07435d1f22f9e 100644 --- a/pom.xml +++ b/pom.xml @@ -804,6 +804,7 @@ sdk/policyinsights sdk/postgresql sdk/postgresqlflexibleserver + sdk/postgresqlhsc sdk/powerbidedicated sdk/purview sdk/quantum diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/CHANGELOG.md b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/CHANGELOG.md new file mode 100644 index 0000000000000..66e90afced14f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-12-10) + +- Azure Resource Manager postgresqlhsc client library for Java. This package contains Microsoft Azure SDK for postgresqlhsc Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL Hyperscale (Citus) resources including server groups, servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations. Package tag package-2020-10-05-privatepreview. 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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/README.md b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/README.md new file mode 100644 index 0000000000000..90ff8775383ad --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager postgresqlhsc client library for Java + +Azure Resource Manager postgresqlhsc client library for Java. + +This package contains Microsoft Azure SDK for postgresqlhsc Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL Hyperscale (Citus) resources including server groups, servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations. Package tag package-2020-10-05-privatepreview. 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-postgresqlhsc;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-postgresqlhsc + 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] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +PostgresqlhscManager manager = PostgresqlhscManager + .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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[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 diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/SAMPLE.md b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/SAMPLE.md new file mode 100644 index 0000000000000..e758f7d43b89e --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/SAMPLE.md @@ -0,0 +1,827 @@ +# Code snippets and samples + + +## Configurations + +- [Get](#configurations_get) +- [ListByServer](#configurations_listbyserver) +- [ListByServerGroup](#configurations_listbyservergroup) +- [Update](#configurations_update) + +## FirewallRules + +- [CreateOrUpdate](#firewallrules_createorupdate) +- [Delete](#firewallrules_delete) +- [Get](#firewallrules_get) +- [ListByServerGroup](#firewallrules_listbyservergroup) + +## Operations + +- [List](#operations_list) + +## Roles + +- [Create](#roles_create) +- [Delete](#roles_delete) +- [ListByServerGroup](#roles_listbyservergroup) + +## ServerGroups + +- [CheckNameAvailability](#servergroups_checknameavailability) +- [CreateOrUpdate](#servergroups_createorupdate) +- [Delete](#servergroups_delete) +- [GetByResourceGroup](#servergroups_getbyresourcegroup) +- [List](#servergroups_list) +- [ListByResourceGroup](#servergroups_listbyresourcegroup) +- [Restart](#servergroups_restart) +- [Start](#servergroups_start) +- [Stop](#servergroups_stop) +- [Update](#servergroups_update) + +## Servers + +- [Get](#servers_get) +- [ListByServerGroup](#servers_listbyservergroup) +### Configurations_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Configurations Get. */ +public final class ConfigurationsGetSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ConfigurationGet.json + */ + /** + * Sample code: Get single configuration of the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getSingleConfigurationOfTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.configurations().getWithResponse("TestResourceGroup", "hsctestsg", "array_nulls", Context.NONE); + } +} +``` + +### Configurations_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for Configurations ListByServer. */ +public final class ConfigurationsListByServerSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ConfigurationListByServer.json + */ + /** + * Sample code: List configurations of the server that in the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listConfigurationsOfTheServerThatInTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.configurations().listByServer("TestResourceGroup", "hsctestsg", "testserver", Context.NONE); + } +} +``` + +### Configurations_ListByServerGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Configurations ListByServerGroup. */ +public final class ConfigurationsListByServerGroupSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ConfigurationListByServerGroup.json + */ + /** + * Sample code: List configurations of the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listConfigurationsOfTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.configurations().listByServerGroup("TestResourceGroup", "hsctestsg", Context.NONE); + } +} +``` + +### Configurations_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupConfigurationInner; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRole; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRoleGroupConfiguration; +import java.util.Arrays; + +/** Samples for Configurations Update. */ +public final class ConfigurationsUpdateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ConfigurationUpdate.json + */ + /** + * Sample code: Update single configuration of the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateSingleConfigurationOfTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .configurations() + .update( + "TestResourceGroup", + "hsctestsg", + "array_nulls", + new ServerGroupConfigurationInner() + .withServerRoleGroupConfigurations( + Arrays + .asList( + new ServerRoleGroupConfiguration().withRole(ServerRole.COORDINATOR).withValue("on"), + new ServerRoleGroupConfiguration().withRole(ServerRole.WORKER).withValue("off"))), + Context.NONE); + } +} +``` + +### FirewallRules_CreateOrUpdate + +```java +/** Samples for FirewallRules CreateOrUpdate. */ +public final class FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/FirewallRuleCreate.json + */ + /** + * Sample code: Create a firewall rule of the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void createAFirewallRuleOfTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .firewallRules() + .define("rule1") + .withExistingServerGroupsv2("TestGroup", "pgtestsvc4") + .withStartIpAddress("0.0.0.0") + .withEndIpAddress("255.255.255.255") + .create(); + } +} +``` + +### FirewallRules_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for FirewallRules Delete. */ +public final class FirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/FirewallRuleDelete.json + */ + /** + * Sample code: Delete the firewall rule of the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void deleteTheFirewallRuleOfTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.firewallRules().delete("TestGroup", "pgtestsvc4", "rule1", Context.NONE); + } +} +``` + +### FirewallRules_Get + +```java +import com.azure.core.util.Context; + +/** Samples for FirewallRules Get. */ +public final class FirewallRulesGetSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/FirewallRuleGet.json + */ + /** + * Sample code: Get the firewall rule of the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getTheFirewallRuleOfTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.firewallRules().getWithResponse("TestGroup", "pgtestsvc4", "rule1", Context.NONE); + } +} +``` + +### FirewallRules_ListByServerGroup + +```java +import com.azure.core.util.Context; + +/** Samples for FirewallRules ListByServerGroup. */ +public final class FirewallRulesListByServerGroupSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/FirewallRuleListByServerGroup.json + */ + /** + * Sample code: List firewall rules of the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listFirewallRulesOfTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.firewallRules().listByServerGroup("TestGroup", "pgtestsvc4", Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/OperationList.json + */ + /** + * Sample code: List all available operations. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listAllAvailableOperations( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + +### Roles_Create + +```java +/** Samples for Roles Create. */ +public final class RolesCreateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/RoleCreate.json + */ + /** + * Sample code: RoleCreate. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void roleCreate(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .roles() + .define("role1") + .withExistingServerGroupsv2("TestGroup", "pgtestsvc4") + .withPassword("secret") + .create(); + } +} +``` + +### Roles_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Roles Delete. */ +public final class RolesDeleteSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/RoleDelete.json + */ + /** + * Sample code: RoleDelete. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void roleDelete(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.roles().delete("TestGroup", "pgtestsvc4", "role1", Context.NONE); + } +} +``` + +### Roles_ListByServerGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Roles ListByServerGroup. */ +public final class RolesListByServerGroupSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/RoleListByServerGroup.json + */ + /** + * Sample code: RoleList. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void roleList(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.roles().listByServerGroup("TestGroup", "pgtestsvc4", Context.NONE); + } +} +``` + +### ServerGroups_CheckNameAvailability + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.models.NameAvailabilityRequest; + +/** Samples for ServerGroups CheckNameAvailability. */ +public final class ServerGroupsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/CheckNameAvailability.json + */ + /** + * Sample code: Check name availability. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void checkNameAvailability(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .serverGroups() + .checkNameAvailabilityWithResponse(new NameAvailabilityRequest().withName("name1"), Context.NONE); + } +} +``` + +### ServerGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.postgresqlhsc.models.CitusVersion; +import com.azure.resourcemanager.postgresqlhsc.models.CreateMode; +import com.azure.resourcemanager.postgresqlhsc.models.PostgreSqlVersion; +import com.azure.resourcemanager.postgresqlhsc.models.ServerEdition; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupPropertiesDelegatedSubnetArguments; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupPropertiesPrivateDnsZoneArguments; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRole; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRoleGroup; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ServerGroups CreateOrUpdate. */ +public final class ServerGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupCreateReadReplica.json + */ + /** + * Sample code: Create a new server group as a read replica. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void createANewServerGroupAsAReadReplica( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .serverGroups() + .define("hsctestsg") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withCreateMode(CreateMode.READ_REPLICA) + .withSourceSubscriptionId("dddddddd-dddd-dddd-dddd-dddddddddddd") + .withSourceResourceGroupName("SourceGroup") + .withSourceServerGroupName("pgtests-source-server-group") + .withSourceLocation("eastus") + .create(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupCreate.json + */ + /** + * Sample code: Create a new server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void createANewServerGroup(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .serverGroups() + .define("hsctestsg") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withTags(mapOf("ElasticServer", "1")) + .withAdministratorLogin("citus") + .withAdministratorLoginPassword("password") + .withBackupRetentionDays(35) + .withPostgresqlVersion(PostgreSqlVersion.ONE_TWO) + .withCitusVersion(CitusVersion.NINE_FIVE) + .withEnableMx(true) + .withEnableZfs(false) + .withServerRoleGroups( + Arrays + .asList( + new ServerRoleGroup() + .withServerEdition(ServerEdition.GENERAL_PURPOSE) + .withStorageQuotaInMb(524288L) + .withVCores(4L) + .withEnableHa(true) + .withName("") + .withRole(ServerRole.COORDINATOR) + .withServerCount(1), + new ServerRoleGroup() + .withServerEdition(ServerEdition.MEMORY_OPTIMIZED) + .withStorageQuotaInMb(524288L) + .withVCores(4L) + .withEnableHa(false) + .withName("") + .withRole(ServerRole.WORKER) + .withServerCount(3))) + .withAvailabilityZone("1") + .withStandbyAvailabilityZone("2") + .withDelegatedSubnetArguments( + new ServerGroupPropertiesDelegatedSubnetArguments() + .withSubnetArmResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet")) + .withPrivateDnsZoneArguments( + new ServerGroupPropertiesPrivateDnsZoneArguments() + .withPrivateDnsZoneArmResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone")) + .create(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupCreatePITR.json + */ + /** + * Sample code: Create a new server group as a point in time restore. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void createANewServerGroupAsAPointInTimeRestore( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .serverGroups() + .define("hsctestsg") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) + .withEnableMx(true) + .withEnableZfs(false) + .withSourceSubscriptionId("dddddddd-dddd-dddd-dddd-dddddddddddd") + .withSourceResourceGroupName("SourceGroup") + .withSourceServerGroupName("pgtests-source-server-group") + .withSourceLocation("eastus") + .withPointInTimeUtc(OffsetDateTime.parse("2017-12-14T00:00:37.467Z")) + .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; + } +} +``` + +### ServerGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ServerGroups Delete. */ +public final class ServerGroupsDeleteSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupDelete.json + */ + /** + * Sample code: Delete the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void deleteTheServerGroup(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.serverGroups().delete("TestGroup", "testservergroup", Context.NONE); + } +} +``` + +### ServerGroups_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ServerGroups GetByResourceGroup. */ +public final class ServerGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupGet.json + */ + /** + * Sample code: Get the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getTheServerGroup(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.serverGroups().getByResourceGroupWithResponse("TestGroup", "hsctestsg1", Context.NONE); + } +} +``` + +### ServerGroups_List + +```java +import com.azure.core.util.Context; + +/** Samples for ServerGroups List. */ +public final class ServerGroupsListSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupList.json + */ + /** + * Sample code: List all the server groups. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listAllTheServerGroups(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.serverGroups().list(Context.NONE); + } +} +``` + +### ServerGroups_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ServerGroups ListByResourceGroup. */ +public final class ServerGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupListByResourceGroup.json + */ + /** + * Sample code: List the server groups by resource group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listTheServerGroupsByResourceGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.serverGroups().listByResourceGroup("TestGroup", Context.NONE); + } +} +``` + +### ServerGroups_Restart + +```java +import com.azure.core.util.Context; + +/** Samples for ServerGroups Restart. */ +public final class ServerGroupsRestartSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupRestart.json + */ + /** + * Sample code: Restart all servers in the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void restartAllServersInTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.serverGroups().restart("TestGroup", "hsctestsg1", Context.NONE); + } +} +``` + +### ServerGroups_Start + +```java +import com.azure.core.util.Context; + +/** Samples for ServerGroups Start. */ +public final class ServerGroupsStartSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupStart.json + */ + /** + * Sample code: Start all servers in the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void startAllServersInTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.serverGroups().start("TestGroup", "hsctestsg1", Context.NONE); + } +} +``` + +### ServerGroups_Stop + +```java +import com.azure.core.util.Context; + +/** Samples for ServerGroups Stop. */ +public final class ServerGroupsStopSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupStop.json + */ + /** + * Sample code: Stop all servers in the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void stopAllServersInTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.serverGroups().stop("TestGroup", "hsctestsg1", Context.NONE); + } +} +``` + +### ServerGroups_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlhsc.models.PostgreSqlVersion; +import com.azure.resourcemanager.postgresqlhsc.models.ServerEdition; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroup; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRole; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRoleGroup; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ServerGroups Update. */ +public final class ServerGroupsUpdateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupScaleStorage.json + */ + /** + * Sample code: Scale storage. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void scaleStorage(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ServerGroup resource = + manager.serverGroups().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource + .update() + .withServerRoleGroups( + Arrays + .asList( + new ServerRoleGroup().withStorageQuotaInMb(8388608L).withName("").withRole(ServerRole.WORKER))) + .apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupAddNode.json + */ + /** + * Sample code: Add new worker nodes. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void addNewWorkerNodes(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ServerGroup resource = + manager.serverGroups().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource + .update() + .withServerRoleGroups( + Arrays.asList(new ServerRoleGroup().withName("").withRole(ServerRole.WORKER).withServerCount(10))) + .apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupUpdateMaintenanceWindow.json + */ + /** + * Sample code: Update customer maintenance window. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateCustomerMaintenanceWindow( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ServerGroup resource = + manager.serverGroups().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource + .update() + .withMaintenanceWindow( + new MaintenanceWindow() + .withCustomWindow("Enabled") + .withStartHour(8) + .withStartMinute(0) + .withDayOfWeek(0)) + .apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupScaleCompute.json + */ + /** + * Sample code: Scale compute. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void scaleCompute(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ServerGroup resource = + manager.serverGroups().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource + .update() + .withServerRoleGroups( + Arrays.asList(new ServerRoleGroup().withVCores(16L).withName("").withRole(ServerRole.COORDINATOR))) + .apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupUpdate.json + */ + /** + * Sample code: Update the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateTheServerGroup(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ServerGroup resource = + manager.serverGroups().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("ElasticServer", "2")) + .withAdministratorLoginPassword("secret") + .withBackupRetentionDays(30) + .withPostgresqlVersion(PostgreSqlVersion.ONE_TWO) + .withServerRoleGroups( + Arrays + .asList( + new ServerRoleGroup() + .withServerEdition(ServerEdition.GENERAL_PURPOSE) + .withStorageQuotaInMb(1048576L) + .withVCores(8L) + .withEnableHa(false) + .withName("") + .withRole(ServerRole.COORDINATOR) + .withServerCount(1), + new ServerRoleGroup() + .withServerEdition(ServerEdition.MEMORY_OPTIMIZED) + .withStorageQuotaInMb(524288L) + .withVCores(4L) + .withEnableHa(true) + .withName("") + .withRole(ServerRole.WORKER) + .withServerCount(4))) + .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; + } +} +``` + +### Servers_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Servers Get. */ +public final class ServersGetSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGet.json + */ + /** + * Sample code: Get the server of server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getTheServerOfServerGroup(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.servers().getWithResponse("TestGroup", "hsctestsg1", "hsctestsg1-c", Context.NONE); + } +} +``` + +### Servers_ListByServerGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Servers ListByServerGroup. */ +public final class ServersListByServerGroupSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerListByServerGroup.json + */ + /** + * Sample code: List servers of the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listServersOfTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.servers().listByServerGroup("TestGroup", "hsctestsg1", Context.NONE); + } +} +``` + diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/pom.xml b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/pom.xml new file mode 100644 index 0000000000000..4ccda36583b10 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/pom.xml @@ -0,0 +1,81 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-postgresqlhsc + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for postgresqlhsc Management + This package contains Microsoft Azure SDK for postgresqlhsc 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 Hyperscale (Citus) resources including server groups, servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations. Package tag package-2020-10-05-privatepreview. + 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 + true + false + + + + + + com.azure + azure-core + 1.23.1 + + + com.azure + azure-core-management + 1.4.4 + + + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/PostgresqlhscManager.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/PostgresqlhscManager.java new file mode 100644 index 0000000000000..baf6d7f5764da --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/PostgresqlhscManager.java @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc; + +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.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.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.postgresqlhsc.fluent.MicrosoftPostgreSqlHyperscale; +import com.azure.resourcemanager.postgresqlhsc.implementation.ConfigurationsImpl; +import com.azure.resourcemanager.postgresqlhsc.implementation.FirewallRulesImpl; +import com.azure.resourcemanager.postgresqlhsc.implementation.MicrosoftPostgreSqlHyperscaleBuilder; +import com.azure.resourcemanager.postgresqlhsc.implementation.OperationsImpl; +import com.azure.resourcemanager.postgresqlhsc.implementation.RolesImpl; +import com.azure.resourcemanager.postgresqlhsc.implementation.ServerGroupsImpl; +import com.azure.resourcemanager.postgresqlhsc.implementation.ServersImpl; +import com.azure.resourcemanager.postgresqlhsc.models.Configurations; +import com.azure.resourcemanager.postgresqlhsc.models.FirewallRules; +import com.azure.resourcemanager.postgresqlhsc.models.Operations; +import com.azure.resourcemanager.postgresqlhsc.models.Roles; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroups; +import com.azure.resourcemanager.postgresqlhsc.models.Servers; +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 PostgresqlhscManager. The Microsoft Azure management API provides create, read, update, and delete + * functionality for Azure PostgreSQL Hyperscale (Citus) resources including server groups, servers, databases, firewall + * rules, VNET rules, security alert policies, log files and configurations. + */ +public final class PostgresqlhscManager { + private ServerGroups serverGroups; + + private Servers servers; + + private Configurations configurations; + + private FirewallRules firewallRules; + + private Roles roles; + + private Operations operations; + + private final MicrosoftPostgreSqlHyperscale clientObject; + + private PostgresqlhscManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new MicrosoftPostgreSqlHyperscaleBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of postgresqlhsc service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the postgresqlhsc service API instance. + */ + public static PostgresqlhscManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create PostgresqlhscManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new PostgresqlhscManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private 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 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 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, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of postgresqlhsc service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the postgresqlhsc service API instance. + */ + public PostgresqlhscManager 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.postgresqlhsc") + .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) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + 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 PostgresqlhscManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of ServerGroups. */ + public ServerGroups serverGroups() { + if (this.serverGroups == null) { + this.serverGroups = new ServerGroupsImpl(clientObject.getServerGroups(), this); + } + return serverGroups; + } + + /** @return Resource collection API of Servers. */ + public Servers servers() { + if (this.servers == null) { + this.servers = new ServersImpl(clientObject.getServers(), this); + } + return servers; + } + + /** @return Resource collection API of Configurations. */ + public Configurations configurations() { + if (this.configurations == null) { + this.configurations = new ConfigurationsImpl(clientObject.getConfigurations(), this); + } + return configurations; + } + + /** @return Resource collection API of FirewallRules. */ + public FirewallRules firewallRules() { + if (this.firewallRules == null) { + this.firewallRules = new FirewallRulesImpl(clientObject.getFirewallRules(), this); + } + return firewallRules; + } + + /** @return Resource collection API of Roles. */ + public Roles roles() { + if (this.roles == null) { + this.roles = new RolesImpl(clientObject.getRoles(), this); + } + return roles; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * @return Wrapped service client MicrosoftPostgreSqlHyperscale providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public MicrosoftPostgreSqlHyperscale serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/ConfigurationsClient.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/ConfigurationsClient.java new file mode 100644 index 0000000000000..adfdbd1c5c434 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/ConfigurationsClient.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.postgresqlhsc.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationInner; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupConfigurationInner; + +/** An instance of this class provides access to all the operations defined in ConfigurationsClient. */ +public interface ConfigurationsClient { + /** + * List all the configurations of a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverGroupName, String serverName); + + /** + * List all the configurations of a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverGroupName, String serverName, Context context); + + /** + * List all the configurations of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 group configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName); + + /** + * List all the configurations of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 group configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServerGroup( + String resourceGroupName, String serverGroupName, Context context); + + /** + * Updates configuration of server role groups in a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group configuration. + * @param parameters The required parameters for updating a server group 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 the configuration list of server role groups in a server group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerGroupConfigurationInner> beginUpdate( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner parameters); + + /** + * Updates configuration of server role groups in a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group configuration. + * @param parameters The required parameters for updating a server group 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 the configuration list of server role groups in a server group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerGroupConfigurationInner> beginUpdate( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner parameters, + Context context); + + /** + * Updates configuration of server role groups in a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group configuration. + * @param parameters The required parameters for updating a server group 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 the configuration list of server role groups in a server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerGroupConfigurationInner update( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner parameters); + + /** + * Updates configuration of server role groups in a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group configuration. + * @param parameters The required parameters for updating a server group 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 the configuration list of server role groups in a server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerGroupConfigurationInner update( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner parameters, + Context context); + + /** + * Gets information about single server group configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group 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 single server group configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerGroupConfigurationInner get(String resourceGroupName, String serverGroupName, String configurationName); + + /** + * Gets information about single server group configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group 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 single server group configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverGroupName, String configurationName, Context context); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/FirewallRulesClient.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/FirewallRulesClient.java new file mode 100644 index 0000000000000..c227fba9bec54 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/FirewallRulesClient.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.FirewallRuleInner; + +/** 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 serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 group firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, String serverGroupName, 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 serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 group firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverGroupName, + 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 serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 group firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner createOrUpdate( + String resourceGroupName, String serverGroupName, 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 serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 group firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner createOrUpdate( + String resourceGroupName, + String serverGroupName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context); + + /** + * Deletes a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverGroupName, String firewallRuleName); + + /** + * Deletes a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverGroupName, String firewallRuleName, Context context); + + /** + * Deletes a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 serverGroupName, String firewallRuleName); + + /** + * Deletes a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 serverGroupName, String firewallRuleName, Context context); + + /** + * Gets information about a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 information about a server group firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner get(String resourceGroupName, String serverGroupName, String firewallRuleName); + + /** + * Gets information about a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 information about a server group firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverGroupName, String firewallRuleName, Context context); + + /** + * List all the firewall rules in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName); + + /** + * List all the firewall rules in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServerGroup( + String resourceGroupName, String serverGroupName, Context context); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/MicrosoftPostgreSqlHyperscale.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/MicrosoftPostgreSqlHyperscale.java new file mode 100644 index 0000000000000..50a2c829e0954 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/MicrosoftPostgreSqlHyperscale.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.postgresqlhsc.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for MicrosoftPostgreSqlHyperscale class. */ +public interface MicrosoftPostgreSqlHyperscale { + /** + * 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 ServerGroupsClient object to access its operations. + * + * @return the ServerGroupsClient object. + */ + ServerGroupsClient getServerGroups(); + + /** + * Gets the ServersClient object to access its operations. + * + * @return the ServersClient object. + */ + ServersClient getServers(); + + /** + * Gets the ConfigurationsClient object to access its operations. + * + * @return the ConfigurationsClient object. + */ + ConfigurationsClient getConfigurations(); + + /** + * Gets the FirewallRulesClient object to access its operations. + * + * @return the FirewallRulesClient object. + */ + FirewallRulesClient getFirewallRules(); + + /** + * Gets the RolesClient object to access its operations. + * + * @return the RolesClient object. + */ + RolesClient getRoles(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/OperationsClient.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/OperationsClient.java new file mode 100644 index 0000000000000..c79d237d7eaa3 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/OperationsClient.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.postgresqlhsc.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.OperationInner; + +/** 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/RolesClient.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/RolesClient.java new file mode 100644 index 0000000000000..32aececc6d293 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/RolesClient.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.RoleInner; + +/** An instance of this class provides access to all the operations defined in RolesClient. */ +public interface RolesClient { + /** + * Creates a new role or updates an existing role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param parameters The required parameters for creating or updating a role. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 group role. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RoleInner> beginCreate( + String resourceGroupName, String serverGroupName, String roleName, RoleInner parameters); + + /** + * Creates a new role or updates an existing role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param parameters The required parameters for creating or updating a role. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 group role. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RoleInner> beginCreate( + String resourceGroupName, String serverGroupName, String roleName, RoleInner parameters, Context context); + + /** + * Creates a new role or updates an existing role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param parameters The required parameters for creating or updating a role. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 group role. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleInner create(String resourceGroupName, String serverGroupName, String roleName, RoleInner parameters); + + /** + * Creates a new role or updates an existing role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param parameters The required parameters for creating or updating a role. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 group role. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleInner create( + String resourceGroupName, String serverGroupName, String roleName, RoleInner parameters, Context context); + + /** + * Deletes a server group role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverGroupName, String roleName); + + /** + * Deletes a server group role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverGroupName, String roleName, Context context); + + /** + * Deletes a server group role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverGroupName, String roleName); + + /** + * Deletes a server group role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverGroupName, String roleName, Context context); + + /** + * List all the roles in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of roles. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName); + + /** + * List all the roles in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of roles. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName, Context context); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/ServerGroupsClient.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/ServerGroupsClient.java new file mode 100644 index 0000000000000..40c9034cb6d86 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/ServerGroupsClient.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.postgresqlhsc.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupInner; +import com.azure.resourcemanager.postgresqlhsc.models.NameAvailabilityRequest; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupForUpdate; + +/** An instance of this class provides access to all the operations defined in ServerGroupsClient. */ +public interface ServerGroupsClient { + /** + * List all the server groups 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 server groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all the server groups 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 server groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List all the server groups 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 server groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all the server groups 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 server groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Creates a new server group with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The required parameters for creating or updating a server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerGroupInner> beginCreateOrUpdate( + String resourceGroupName, String serverGroupName, ServerGroupInner parameters); + + /** + * Creates a new server group with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The required parameters for creating or updating a server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerGroupInner> beginCreateOrUpdate( + String resourceGroupName, String serverGroupName, ServerGroupInner parameters, Context context); + + /** + * Creates a new server group with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The required parameters for creating or updating a server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerGroupInner createOrUpdate(String resourceGroupName, String serverGroupName, ServerGroupInner parameters); + + /** + * Creates a new server group with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The required parameters for creating or updating a server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerGroupInner createOrUpdate( + String resourceGroupName, String serverGroupName, ServerGroupInner parameters, Context context); + + /** + * Gets information about a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerGroupInner getByResourceGroup(String resourceGroupName, String serverGroupName); + + /** + * Gets information about a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String serverGroupName, Context context); + + /** + * Deletes a server group together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverGroupName); + + /** + * Deletes a server group together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverGroupName, Context context); + + /** + * Deletes a server group together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverGroupName); + + /** + * Deletes a server group together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverGroupName, Context context); + + /** + * Updates an existing server group. The request body can contain one to many of the properties present in the + * normal server group definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The parameters for updating a server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerGroupInner> beginUpdate( + String resourceGroupName, String serverGroupName, ServerGroupForUpdate parameters); + + /** + * Updates an existing server group. The request body can contain one to many of the properties present in the + * normal server group definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The parameters for updating a server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerGroupInner> beginUpdate( + String resourceGroupName, String serverGroupName, ServerGroupForUpdate parameters, Context context); + + /** + * Updates an existing server group. The request body can contain one to many of the properties present in the + * normal server group definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The parameters for updating a server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerGroupInner update(String resourceGroupName, String serverGroupName, ServerGroupForUpdate parameters); + + /** + * Updates an existing server group. The request body can contain one to many of the properties present in the + * normal server group definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The parameters for updating a server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerGroupInner update( + String resourceGroupName, String serverGroupName, ServerGroupForUpdate parameters, Context context); + + /** + * Restarts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart(String resourceGroupName, String serverGroupName); + + /** + * Restarts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart(String resourceGroupName, String serverGroupName, Context context); + + /** + * Restarts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverGroupName); + + /** + * Restarts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverGroupName, Context context); + + /** + * Starts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String serverGroupName); + + /** + * Starts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String serverGroupName, Context context); + + /** + * Starts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverGroupName); + + /** + * Starts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverGroupName, Context context); + + /** + * Stops the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStop(String resourceGroupName, String serverGroupName); + + /** + * Stops the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStop(String resourceGroupName, String serverGroupName, Context context); + + /** + * Stops the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverGroupName); + + /** + * Stops the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverGroupName, 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 checkNameAvailability(NameAvailabilityRequest 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + NameAvailabilityRequest nameAvailabilityRequest, Context context); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/ServersClient.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/ServersClient.java new file mode 100644 index 0000000000000..29751998877e0 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/ServersClient.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.postgresqlhsc.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupServerInner; + +/** An instance of this class provides access to all the operations defined in ServersClient. */ +public interface ServersClient { + /** + * Lists servers of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 in a server group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName); + + /** + * Lists servers of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 in a server group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServerGroup( + String resourceGroupName, String serverGroupName, Context context); + + /** + * Gets information about a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @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 in server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerGroupServerInner get(String resourceGroupName, String serverGroupName, String serverName); + + /** + * Gets information about a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @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 in server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/FirewallRuleInner.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/FirewallRuleInner.java new file mode 100644 index 0000000000000..bed61451ae04b --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/FirewallRuleInner.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a server group firewall rule. */ +@Fluent +public final class FirewallRuleInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FirewallRuleInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The properties of a firewall rule. + */ + @JsonProperty(value = "properties", required = true) + private FirewallRuleProperties innerProperties = new FirewallRuleProperties(); + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: The properties of a firewall rule. + * + * @return the innerProperties value. + */ + private FirewallRuleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the startIpAddress property: The start IP address of the server group 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 group 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 group 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 group 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(); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/FirewallRuleProperties.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/FirewallRuleProperties.java new file mode 100644 index 0000000000000..38a8314754150 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/FirewallRuleProperties.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a server group firewall rule. */ +@Fluent +public final class FirewallRuleProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FirewallRuleProperties.class); + + /* + * The start IP address of the server group firewall rule. Must be IPv4 + * format. + */ + @JsonProperty(value = "startIpAddress", required = true) + private String startIpAddress; + + /* + * The end IP address of the server group firewall rule. Must be IPv4 + * format. + */ + @JsonProperty(value = "endIpAddress", required = true) + private String endIpAddress; + + /** + * Get the startIpAddress property: The start IP address of the server group 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 group 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 group 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 group 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")); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/NameAvailabilityInner.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/NameAvailabilityInner.java new file mode 100644 index 0000000000000..41d38bcd64e7e --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/NameAvailabilityInner.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.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a resource name availability. */ +@Fluent +public final class NameAvailabilityInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NameAvailabilityInner.class); + + /* + * Error Message. + */ + @JsonProperty(value = "message") + private String message; + + /* + * Indicates whether the resource name is available. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * name of the PostgreSQL server. + */ + @JsonProperty(value = "name") + private String name; + + /* + * type of the server + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the message property: Error Message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Error Message. + * + * @param message the message value to set. + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the nameAvailable property: Indicates whether the resource name is available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: Indicates whether the resource name is available. + * + * @param nameAvailable the nameAvailable value to set. + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the name property: name of the PostgreSQL server. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: name of the PostgreSQL server. + * + * @param name the name value to set. + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: type of the server. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: type of the server. + * + * @param type the type value to set. + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner 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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/OperationInner.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..15c9010f2d882 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/OperationInner.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.models.OperationDisplay; +import com.azure.resourcemanager.postgresqlhsc.models.OperationOrigin; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** REST API operation definition. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * 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; + + /** + * 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 OperationInner object itself. + */ + public OperationInner 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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/RoleInner.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/RoleInner.java new file mode 100644 index 0000000000000..7a5aef5c398bf --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/RoleInner.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a server group role. */ +@Fluent +public final class RoleInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoleInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The properties of a role. + */ + @JsonProperty(value = "properties") + private RoleProperties innerProperties; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: The properties of a role. + * + * @return the innerProperties value. + */ + private RoleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the password property: The password of the server group role. + * + * @return the password value. + */ + public String password() { + return this.innerProperties() == null ? null : this.innerProperties().password(); + } + + /** + * Set the password property: The password of the server group role. + * + * @param password the password value to set. + * @return the RoleInner object itself. + */ + public RoleInner withPassword(String password) { + if (this.innerProperties() == null) { + this.innerProperties = new RoleProperties(); + } + this.innerProperties().withPassword(password); + 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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/RoleProperties.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/RoleProperties.java new file mode 100644 index 0000000000000..86386f91bee3a --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/RoleProperties.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.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a server group role. */ +@Fluent +public final class RoleProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoleProperties.class); + + /* + * The password of the server group role. + */ + @JsonProperty(value = "password", required = true) + private String password; + + /** + * Get the password property: The password of the server group role. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The password of the server group role. + * + * @param password the password value to set. + * @return the RoleProperties object itself. + */ + public RoleProperties withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (password() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property password in model RoleProperties")); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerConfigurationInner.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerConfigurationInner.java new file mode 100644 index 0000000000000..ed022c69551d4 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerConfigurationInner.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.postgresqlhsc.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.postgresqlhsc.models.ConfigurationDataType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a configuration. */ +@Fluent +public final class ServerConfigurationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerConfigurationInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The properties of a configuration. + */ + @JsonProperty(value = "properties") + private ServerConfigurationProperties innerProperties; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: The properties of a configuration. + * + * @return the innerProperties value. + */ + private ServerConfigurationProperties 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 ServerConfigurationInner object itself. + */ + public ServerConfigurationInner withValue(String value) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerConfigurationProperties(); + } + this.innerProperties().withValue(value); + return this; + } + + /** + * Get the source property: Source of the configuration. + * + * @return the source value. + */ + public String source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * 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(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerConfigurationProperties.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerConfigurationProperties.java new file mode 100644 index 0000000000000..7a557ed420845 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerConfigurationProperties.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.models.ConfigurationDataType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a configuration. */ +@Fluent +public final class ServerConfigurationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerConfigurationProperties.class); + + /* + * Value of the configuration. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /* + * Source of the configuration. + */ + @JsonProperty(value = "source", access = JsonProperty.Access.WRITE_ONLY) + private String source; + + /* + * 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; + + /** + * 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 ServerConfigurationProperties object itself. + */ + public ServerConfigurationProperties withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the source property: Source of the configuration. + * + * @return the source value. + */ + public String source() { + return this.source; + } + + /** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model ServerConfigurationProperties")); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupConfigurationInner.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupConfigurationInner.java new file mode 100644 index 0000000000000..2ca7e1bfe7381 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupConfigurationInner.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.postgresqlhsc.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.postgresqlhsc.models.ConfigurationDataType; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRoleGroupConfiguration; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the configuration list of server role groups in a server group. */ +@Fluent +public final class ServerGroupConfigurationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerGroupConfigurationInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The properties of server group configuration. + */ + @JsonProperty(value = "properties") + private ServerGroupConfigurationProperties innerProperties; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: The properties of server group configuration. + * + * @return the innerProperties value. + */ + private ServerGroupConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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 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 serverRoleGroupConfigurations property: The list of server role group configuration values. + * + * @return the serverRoleGroupConfigurations value. + */ + public List serverRoleGroupConfigurations() { + return this.innerProperties() == null ? null : this.innerProperties().serverRoleGroupConfigurations(); + } + + /** + * Set the serverRoleGroupConfigurations property: The list of server role group configuration values. + * + * @param serverRoleGroupConfigurations the serverRoleGroupConfigurations value to set. + * @return the ServerGroupConfigurationInner object itself. + */ + public ServerGroupConfigurationInner withServerRoleGroupConfigurations( + List serverRoleGroupConfigurations) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupConfigurationProperties(); + } + this.innerProperties().withServerRoleGroupConfigurations(serverRoleGroupConfigurations); + 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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupConfigurationProperties.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupConfigurationProperties.java new file mode 100644 index 0000000000000..2f3ac27197c9b --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupConfigurationProperties.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.models.ConfigurationDataType; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRoleGroupConfiguration; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties of server group configuration. */ +@Fluent +public final class ServerGroupConfigurationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerGroupConfigurationProperties.class); + + /* + * Description of the configuration. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * 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; + + /* + * The list of server role group configuration values. + */ + @JsonProperty(value = "serverRoleGroupConfigurations", required = true) + private List serverRoleGroupConfigurations; + + /** + * Get the description property: Description of the configuration. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * 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 serverRoleGroupConfigurations property: The list of server role group configuration values. + * + * @return the serverRoleGroupConfigurations value. + */ + public List serverRoleGroupConfigurations() { + return this.serverRoleGroupConfigurations; + } + + /** + * Set the serverRoleGroupConfigurations property: The list of server role group configuration values. + * + * @param serverRoleGroupConfigurations the serverRoleGroupConfigurations value to set. + * @return the ServerGroupConfigurationProperties object itself. + */ + public ServerGroupConfigurationProperties withServerRoleGroupConfigurations( + List serverRoleGroupConfigurations) { + this.serverRoleGroupConfigurations = serverRoleGroupConfigurations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverRoleGroupConfigurations() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property serverRoleGroupConfigurations in model" + + " ServerGroupConfigurationProperties")); + } else { + serverRoleGroupConfigurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupInner.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupInner.java new file mode 100644 index 0000000000000..84534099558d5 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupInner.java @@ -0,0 +1,604 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.models.CitusVersion; +import com.azure.resourcemanager.postgresqlhsc.models.CreateMode; +import com.azure.resourcemanager.postgresqlhsc.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlhsc.models.PostgreSqlVersion; +import com.azure.resourcemanager.postgresqlhsc.models.ResourceProviderType; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupPropertiesDelegatedSubnetArguments; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupPropertiesPrivateDnsZoneArguments; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRoleGroup; +import com.azure.resourcemanager.postgresqlhsc.models.ServerState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Represents a server group for create. */ +@Fluent +public final class ServerGroupInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerGroupInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Properties of the server group create. + */ + @JsonProperty(value = "properties") + private ServerGroupProperties innerProperties; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Properties of the server group create. + * + * @return the innerProperties value. + */ + private ServerGroupProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ServerGroupInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerGroupInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the createMode property: The mode to create a new server group. + * + * @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 server group. + * + * @param createMode the createMode value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withCreateMode(CreateMode createMode) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withCreateMode(createMode); + return this; + } + + /** + * Get the administratorLogin property: The administrator's login name of servers in server group. 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 servers in server group. Can only be + * specified when the server is being created (and is required for creation). + * + * @param administratorLogin the administratorLogin value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withAdministratorLogin(String administratorLogin) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withAdministratorLogin(administratorLogin); + 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 ServerGroupInner object itself. + */ + public ServerGroupInner withAdministratorLoginPassword(String administratorLoginPassword) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + /** + * Get the backupRetentionDays property: The backup retention days for server group. + * + * @return the backupRetentionDays value. + */ + public Integer backupRetentionDays() { + return this.innerProperties() == null ? null : this.innerProperties().backupRetentionDays(); + } + + /** + * Set the backupRetentionDays property: The backup retention days for server group. + * + * @param backupRetentionDays the backupRetentionDays value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withBackupRetentionDays(Integer backupRetentionDays) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withBackupRetentionDays(backupRetentionDays); + return this; + } + + /** + * Get the postgresqlVersion property: The PostgreSQL version of server group. + * + * @return the postgresqlVersion value. + */ + public PostgreSqlVersion postgresqlVersion() { + return this.innerProperties() == null ? null : this.innerProperties().postgresqlVersion(); + } + + /** + * Set the postgresqlVersion property: The PostgreSQL version of server group. + * + * @param postgresqlVersion the postgresqlVersion value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withPostgresqlVersion(PostgreSqlVersion postgresqlVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withPostgresqlVersion(postgresqlVersion); + return this; + } + + /** + * Get the citusVersion property: The Citus version of server group. + * + * @return the citusVersion value. + */ + public CitusVersion citusVersion() { + return this.innerProperties() == null ? null : this.innerProperties().citusVersion(); + } + + /** + * Set the citusVersion property: The Citus version of server group. + * + * @param citusVersion the citusVersion value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withCitusVersion(CitusVersion citusVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withCitusVersion(citusVersion); + return this; + } + + /** + * Get the enableMx property: If Citus MX is enabled or not for the server group. + * + * @return the enableMx value. + */ + public Boolean enableMx() { + return this.innerProperties() == null ? null : this.innerProperties().enableMx(); + } + + /** + * Set the enableMx property: If Citus MX is enabled or not for the server group. + * + * @param enableMx the enableMx value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withEnableMx(Boolean enableMx) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withEnableMx(enableMx); + return this; + } + + /** + * Get the enableZfs property: If ZFS compression is enabled or not for the server group. + * + * @return the enableZfs value. + */ + public Boolean enableZfs() { + return this.innerProperties() == null ? null : this.innerProperties().enableZfs(); + } + + /** + * Set the enableZfs property: If ZFS compression is enabled or not for the server group. + * + * @param enableZfs the enableZfs value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withEnableZfs(Boolean enableZfs) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withEnableZfs(enableZfs); + return this; + } + + /** + * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the server group. + * + * @return the enableShardsOnCoordinator value. + */ + public Boolean enableShardsOnCoordinator() { + return this.innerProperties() == null ? null : this.innerProperties().enableShardsOnCoordinator(); + } + + /** + * Set the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the server group. + * + * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withEnableShardsOnCoordinator(enableShardsOnCoordinator); + return this; + } + + /** + * Get the state property: A state of a server group that is visible to user. + * + * @return the state value. + */ + public ServerState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the earliestRestoreTime property: The earliest restore point time (ISO8601 format) for server group. + * + * @return the earliestRestoreTime value. + */ + public OffsetDateTime earliestRestoreTime() { + return this.innerProperties() == null ? null : this.innerProperties().earliestRestoreTime(); + } + + /** + * Get the resourceProviderType property: The resource provider type of server group. + * + * @return the resourceProviderType value. + */ + public ResourceProviderType resourceProviderType() { + return this.innerProperties() == null ? null : this.innerProperties().resourceProviderType(); + } + + /** + * Get the serverRoleGroups property: The list of server role groups. + * + * @return the serverRoleGroups value. + */ + public List serverRoleGroups() { + return this.innerProperties() == null ? null : this.innerProperties().serverRoleGroups(); + } + + /** + * Set the serverRoleGroups property: The list of server role groups. + * + * @param serverRoleGroups the serverRoleGroups value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withServerRoleGroups(List serverRoleGroups) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withServerRoleGroups(serverRoleGroups); + return this; + } + + /** + * Get the maintenanceWindow property: Maintenance window of a server group. + * + * @return the maintenanceWindow value. + */ + public MaintenanceWindow maintenanceWindow() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceWindow(); + } + + /** + * Set the maintenanceWindow property: Maintenance window of a server group. + * + * @param maintenanceWindow the maintenanceWindow value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withMaintenanceWindow(maintenanceWindow); + return this; + } + + /** + * Get the availabilityZone property: Availability Zone information of the server group. + * + * @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 group. + * + * @param availabilityZone the availabilityZone value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withAvailabilityZone(String availabilityZone) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withAvailabilityZone(availabilityZone); + return this; + } + + /** + * Get the standbyAvailabilityZone property: Standby Availability Zone information of the server group. + * + * @return the standbyAvailabilityZone value. + */ + public String standbyAvailabilityZone() { + return this.innerProperties() == null ? null : this.innerProperties().standbyAvailabilityZone(); + } + + /** + * Set the standbyAvailabilityZone property: Standby Availability Zone information of the server group. + * + * @param standbyAvailabilityZone the standbyAvailabilityZone value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withStandbyAvailabilityZone(String standbyAvailabilityZone) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withStandbyAvailabilityZone(standbyAvailabilityZone); + return this; + } + + /** + * Get the delegatedSubnetArguments property: The delegated subnet arguments for a server group. + * + * @return the delegatedSubnetArguments value. + */ + public ServerGroupPropertiesDelegatedSubnetArguments delegatedSubnetArguments() { + return this.innerProperties() == null ? null : this.innerProperties().delegatedSubnetArguments(); + } + + /** + * Set the delegatedSubnetArguments property: The delegated subnet arguments for a server group. + * + * @param delegatedSubnetArguments the delegatedSubnetArguments value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withDelegatedSubnetArguments( + ServerGroupPropertiesDelegatedSubnetArguments delegatedSubnetArguments) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withDelegatedSubnetArguments(delegatedSubnetArguments); + return this; + } + + /** + * Get the privateDnsZoneArguments property: The private dns zone arguments for a server group. + * + * @return the privateDnsZoneArguments value. + */ + public ServerGroupPropertiesPrivateDnsZoneArguments privateDnsZoneArguments() { + return this.innerProperties() == null ? null : this.innerProperties().privateDnsZoneArguments(); + } + + /** + * Set the privateDnsZoneArguments property: The private dns zone arguments for a server group. + * + * @param privateDnsZoneArguments the privateDnsZoneArguments value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withPrivateDnsZoneArguments( + ServerGroupPropertiesPrivateDnsZoneArguments privateDnsZoneArguments) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withPrivateDnsZoneArguments(privateDnsZoneArguments); + return this; + } + + /** + * Get the readReplicas property: The array of read replica server groups. + * + * @return the readReplicas value. + */ + public List readReplicas() { + return this.innerProperties() == null ? null : this.innerProperties().readReplicas(); + } + + /** + * Get the sourceServerGroup property: The source server group id for read replica server groups. + * + * @return the sourceServerGroup value. + */ + public String sourceServerGroup() { + return this.innerProperties() == null ? null : this.innerProperties().sourceServerGroup(); + } + + /** + * Get the sourceSubscriptionId property: The source subscription id to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @return the sourceSubscriptionId value. + */ + public String sourceSubscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceSubscriptionId(); + } + + /** + * Set the sourceSubscriptionId property: The source subscription id to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @param sourceSubscriptionId the sourceSubscriptionId value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withSourceSubscriptionId(String sourceSubscriptionId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withSourceSubscriptionId(sourceSubscriptionId); + return this; + } + + /** + * Get the sourceResourceGroupName property: The source resource group name to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @return the sourceResourceGroupName value. + */ + public String sourceResourceGroupName() { + return this.innerProperties() == null ? null : this.innerProperties().sourceResourceGroupName(); + } + + /** + * Set the sourceResourceGroupName property: The source resource group name to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @param sourceResourceGroupName the sourceResourceGroupName value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withSourceResourceGroupName(String sourceResourceGroupName) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withSourceResourceGroupName(sourceResourceGroupName); + return this; + } + + /** + * Get the sourceServerGroupName property: The source server group name to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @return the sourceServerGroupName value. + */ + public String sourceServerGroupName() { + return this.innerProperties() == null ? null : this.innerProperties().sourceServerGroupName(); + } + + /** + * Set the sourceServerGroupName property: The source server group name to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @param sourceServerGroupName the sourceServerGroupName value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withSourceServerGroupName(String sourceServerGroupName) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withSourceServerGroupName(sourceServerGroupName); + return this; + } + + /** + * Get the sourceLocation property: The source server group location to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @return the sourceLocation value. + */ + public String sourceLocation() { + return this.innerProperties() == null ? null : this.innerProperties().sourceLocation(); + } + + /** + * Set the sourceLocation property: The source server group location to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @param sourceLocation the sourceLocation value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withSourceLocation(String sourceLocation) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withSourceLocation(sourceLocation); + 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'. + * + * @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'. + * + * @param pointInTimeUtc the pointInTimeUtc value to set. + * @return the ServerGroupInner object itself. + */ + public ServerGroupInner withPointInTimeUtc(OffsetDateTime pointInTimeUtc) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupProperties(); + } + this.innerProperties().withPointInTimeUtc(pointInTimeUtc); + 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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupProperties.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupProperties.java new file mode 100644 index 0000000000000..40118c5b47b7b --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupProperties.java @@ -0,0 +1,663 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.models.CitusVersion; +import com.azure.resourcemanager.postgresqlhsc.models.CreateMode; +import com.azure.resourcemanager.postgresqlhsc.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlhsc.models.PostgreSqlVersion; +import com.azure.resourcemanager.postgresqlhsc.models.ResourceProviderType; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupPropertiesDelegatedSubnetArguments; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupPropertiesPrivateDnsZoneArguments; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRoleGroup; +import com.azure.resourcemanager.postgresqlhsc.models.ServerState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The properties used to create a new server group. */ +@Fluent +public final class ServerGroupProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerGroupProperties.class); + + /* + * The mode to create a new server group. + */ + @JsonProperty(value = "createMode") + private CreateMode createMode; + + /* + * The administrator's login name of servers in server group. Can only be + * specified when the server is being created (and is required for + * creation). + */ + @JsonProperty(value = "administratorLogin") + private String administratorLogin; + + /* + * The password of the administrator login. + */ + @JsonProperty(value = "administratorLoginPassword") + private String administratorLoginPassword; + + /* + * The backup retention days for server group. + */ + @JsonProperty(value = "backupRetentionDays") + private Integer backupRetentionDays; + + /* + * The PostgreSQL version of server group. + */ + @JsonProperty(value = "postgresqlVersion") + private PostgreSqlVersion postgresqlVersion; + + /* + * The Citus version of server group. + */ + @JsonProperty(value = "citusVersion") + private CitusVersion citusVersion; + + /* + * If Citus MX is enabled or not for the server group. + */ + @JsonProperty(value = "enableMx") + private Boolean enableMx; + + /* + * If ZFS compression is enabled or not for the server group. + */ + @JsonProperty(value = "enableZfs") + private Boolean enableZfs; + + /* + * If shards on coordinator is enabled or not for the server group. + */ + @JsonProperty(value = "enableShardsOnCoordinator") + private Boolean enableShardsOnCoordinator; + + /* + * A state of a server group that is visible to user. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private ServerState state; + + /* + * The earliest restore point time (ISO8601 format) for server group. + */ + @JsonProperty(value = "earliestRestoreTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime earliestRestoreTime; + + /* + * The resource provider type of server group. + */ + @JsonProperty(value = "resourceProviderType", access = JsonProperty.Access.WRITE_ONLY) + private ResourceProviderType resourceProviderType; + + /* + * The list of server role groups. + */ + @JsonProperty(value = "serverRoleGroups") + private List serverRoleGroups; + + /* + * Maintenance window of a server group. + */ + @JsonProperty(value = "maintenanceWindow") + private MaintenanceWindow maintenanceWindow; + + /* + * Availability Zone information of the server group. + */ + @JsonProperty(value = "availabilityZone") + private String availabilityZone; + + /* + * Standby Availability Zone information of the server group. + */ + @JsonProperty(value = "standbyAvailabilityZone") + private String standbyAvailabilityZone; + + /* + * The delegated subnet arguments for a server group. + */ + @JsonProperty(value = "delegatedSubnetArguments") + private ServerGroupPropertiesDelegatedSubnetArguments delegatedSubnetArguments; + + /* + * The private dns zone arguments for a server group. + */ + @JsonProperty(value = "privateDnsZoneArguments") + private ServerGroupPropertiesPrivateDnsZoneArguments privateDnsZoneArguments; + + /* + * The array of read replica server groups. + */ + @JsonProperty(value = "readReplicas", access = JsonProperty.Access.WRITE_ONLY) + private List readReplicas; + + /* + * The source server group id for read replica server groups. + */ + @JsonProperty(value = "sourceServerGroup", access = JsonProperty.Access.WRITE_ONLY) + private String sourceServerGroup; + + /* + * The source subscription id to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica' + */ + @JsonProperty(value = "sourceSubscriptionId") + private String sourceSubscriptionId; + + /* + * The source resource group name to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica' + */ + @JsonProperty(value = "sourceResourceGroupName") + private String sourceResourceGroupName; + + /* + * The source server group name to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica' + */ + @JsonProperty(value = "sourceServerGroupName") + private String sourceServerGroupName; + + /* + * The source server group location to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica' + */ + @JsonProperty(value = "sourceLocation") + private String sourceLocation; + + /* + * Restore point creation time (ISO8601 format), specifying the time to + * restore from. It's required when 'createMode' is 'PointInTimeRestore' + */ + @JsonProperty(value = "pointInTimeUTC") + private OffsetDateTime pointInTimeUtc; + + /** + * Get the createMode property: The mode to create a new server group. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: The mode to create a new server group. + * + * @param createMode the createMode value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the administratorLogin property: The administrator's login name of servers in server group. 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 servers in server group. Can only be + * specified when the server is being created (and is required for creation). + * + * @param administratorLogin the administratorLogin value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: The password of the administrator login. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The password of the administrator login. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the backupRetentionDays property: The backup retention days for server group. + * + * @return the backupRetentionDays value. + */ + public Integer backupRetentionDays() { + return this.backupRetentionDays; + } + + /** + * Set the backupRetentionDays property: The backup retention days for server group. + * + * @param backupRetentionDays the backupRetentionDays value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withBackupRetentionDays(Integer backupRetentionDays) { + this.backupRetentionDays = backupRetentionDays; + return this; + } + + /** + * Get the postgresqlVersion property: The PostgreSQL version of server group. + * + * @return the postgresqlVersion value. + */ + public PostgreSqlVersion postgresqlVersion() { + return this.postgresqlVersion; + } + + /** + * Set the postgresqlVersion property: The PostgreSQL version of server group. + * + * @param postgresqlVersion the postgresqlVersion value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withPostgresqlVersion(PostgreSqlVersion postgresqlVersion) { + this.postgresqlVersion = postgresqlVersion; + return this; + } + + /** + * Get the citusVersion property: The Citus version of server group. + * + * @return the citusVersion value. + */ + public CitusVersion citusVersion() { + return this.citusVersion; + } + + /** + * Set the citusVersion property: The Citus version of server group. + * + * @param citusVersion the citusVersion value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withCitusVersion(CitusVersion citusVersion) { + this.citusVersion = citusVersion; + return this; + } + + /** + * Get the enableMx property: If Citus MX is enabled or not for the server group. + * + * @return the enableMx value. + */ + public Boolean enableMx() { + return this.enableMx; + } + + /** + * Set the enableMx property: If Citus MX is enabled or not for the server group. + * + * @param enableMx the enableMx value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withEnableMx(Boolean enableMx) { + this.enableMx = enableMx; + return this; + } + + /** + * Get the enableZfs property: If ZFS compression is enabled or not for the server group. + * + * @return the enableZfs value. + */ + public Boolean enableZfs() { + return this.enableZfs; + } + + /** + * Set the enableZfs property: If ZFS compression is enabled or not for the server group. + * + * @param enableZfs the enableZfs value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withEnableZfs(Boolean enableZfs) { + this.enableZfs = enableZfs; + return this; + } + + /** + * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the server group. + * + * @return the enableShardsOnCoordinator value. + */ + public Boolean enableShardsOnCoordinator() { + return this.enableShardsOnCoordinator; + } + + /** + * Set the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the server group. + * + * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) { + this.enableShardsOnCoordinator = enableShardsOnCoordinator; + return this; + } + + /** + * Get the state property: A state of a server group that is visible to user. + * + * @return the state value. + */ + public ServerState state() { + return this.state; + } + + /** + * Get the earliestRestoreTime property: The earliest restore point time (ISO8601 format) for server group. + * + * @return the earliestRestoreTime value. + */ + public OffsetDateTime earliestRestoreTime() { + return this.earliestRestoreTime; + } + + /** + * Get the resourceProviderType property: The resource provider type of server group. + * + * @return the resourceProviderType value. + */ + public ResourceProviderType resourceProviderType() { + return this.resourceProviderType; + } + + /** + * Get the serverRoleGroups property: The list of server role groups. + * + * @return the serverRoleGroups value. + */ + public List serverRoleGroups() { + return this.serverRoleGroups; + } + + /** + * Set the serverRoleGroups property: The list of server role groups. + * + * @param serverRoleGroups the serverRoleGroups value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withServerRoleGroups(List serverRoleGroups) { + this.serverRoleGroups = serverRoleGroups; + return this; + } + + /** + * Get the maintenanceWindow property: Maintenance window of a server group. + * + * @return the maintenanceWindow value. + */ + public MaintenanceWindow maintenanceWindow() { + return this.maintenanceWindow; + } + + /** + * Set the maintenanceWindow property: Maintenance window of a server group. + * + * @param maintenanceWindow the maintenanceWindow value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + this.maintenanceWindow = maintenanceWindow; + return this; + } + + /** + * Get the availabilityZone property: Availability Zone information of the server group. + * + * @return the availabilityZone value. + */ + public String availabilityZone() { + return this.availabilityZone; + } + + /** + * Set the availabilityZone property: Availability Zone information of the server group. + * + * @param availabilityZone the availabilityZone value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withAvailabilityZone(String availabilityZone) { + this.availabilityZone = availabilityZone; + return this; + } + + /** + * Get the standbyAvailabilityZone property: Standby Availability Zone information of the server group. + * + * @return the standbyAvailabilityZone value. + */ + public String standbyAvailabilityZone() { + return this.standbyAvailabilityZone; + } + + /** + * Set the standbyAvailabilityZone property: Standby Availability Zone information of the server group. + * + * @param standbyAvailabilityZone the standbyAvailabilityZone value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withStandbyAvailabilityZone(String standbyAvailabilityZone) { + this.standbyAvailabilityZone = standbyAvailabilityZone; + return this; + } + + /** + * Get the delegatedSubnetArguments property: The delegated subnet arguments for a server group. + * + * @return the delegatedSubnetArguments value. + */ + public ServerGroupPropertiesDelegatedSubnetArguments delegatedSubnetArguments() { + return this.delegatedSubnetArguments; + } + + /** + * Set the delegatedSubnetArguments property: The delegated subnet arguments for a server group. + * + * @param delegatedSubnetArguments the delegatedSubnetArguments value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withDelegatedSubnetArguments( + ServerGroupPropertiesDelegatedSubnetArguments delegatedSubnetArguments) { + this.delegatedSubnetArguments = delegatedSubnetArguments; + return this; + } + + /** + * Get the privateDnsZoneArguments property: The private dns zone arguments for a server group. + * + * @return the privateDnsZoneArguments value. + */ + public ServerGroupPropertiesPrivateDnsZoneArguments privateDnsZoneArguments() { + return this.privateDnsZoneArguments; + } + + /** + * Set the privateDnsZoneArguments property: The private dns zone arguments for a server group. + * + * @param privateDnsZoneArguments the privateDnsZoneArguments value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withPrivateDnsZoneArguments( + ServerGroupPropertiesPrivateDnsZoneArguments privateDnsZoneArguments) { + this.privateDnsZoneArguments = privateDnsZoneArguments; + return this; + } + + /** + * Get the readReplicas property: The array of read replica server groups. + * + * @return the readReplicas value. + */ + public List readReplicas() { + return this.readReplicas; + } + + /** + * Get the sourceServerGroup property: The source server group id for read replica server groups. + * + * @return the sourceServerGroup value. + */ + public String sourceServerGroup() { + return this.sourceServerGroup; + } + + /** + * Get the sourceSubscriptionId property: The source subscription id to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @return the sourceSubscriptionId value. + */ + public String sourceSubscriptionId() { + return this.sourceSubscriptionId; + } + + /** + * Set the sourceSubscriptionId property: The source subscription id to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @param sourceSubscriptionId the sourceSubscriptionId value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withSourceSubscriptionId(String sourceSubscriptionId) { + this.sourceSubscriptionId = sourceSubscriptionId; + return this; + } + + /** + * Get the sourceResourceGroupName property: The source resource group name to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @return the sourceResourceGroupName value. + */ + public String sourceResourceGroupName() { + return this.sourceResourceGroupName; + } + + /** + * Set the sourceResourceGroupName property: The source resource group name to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @param sourceResourceGroupName the sourceResourceGroupName value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withSourceResourceGroupName(String sourceResourceGroupName) { + this.sourceResourceGroupName = sourceResourceGroupName; + return this; + } + + /** + * Get the sourceServerGroupName property: The source server group name to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @return the sourceServerGroupName value. + */ + public String sourceServerGroupName() { + return this.sourceServerGroupName; + } + + /** + * Set the sourceServerGroupName property: The source server group name to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @param sourceServerGroupName the sourceServerGroupName value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withSourceServerGroupName(String sourceServerGroupName) { + this.sourceServerGroupName = sourceServerGroupName; + return this; + } + + /** + * Get the sourceLocation property: The source server group location to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @return the sourceLocation value. + */ + public String sourceLocation() { + return this.sourceLocation; + } + + /** + * Set the sourceLocation property: The source server group location to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @param sourceLocation the sourceLocation value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withSourceLocation(String sourceLocation) { + this.sourceLocation = sourceLocation; + 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'. + * + * @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'. + * + * @param pointInTimeUtc the pointInTimeUtc value to set. + * @return the ServerGroupProperties object itself. + */ + public ServerGroupProperties withPointInTimeUtc(OffsetDateTime pointInTimeUtc) { + this.pointInTimeUtc = pointInTimeUtc; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverRoleGroups() != null) { + serverRoleGroups().forEach(e -> e.validate()); + } + if (maintenanceWindow() != null) { + maintenanceWindow().validate(); + } + if (delegatedSubnetArguments() != null) { + delegatedSubnetArguments().validate(); + } + if (privateDnsZoneArguments() != null) { + privateDnsZoneArguments().validate(); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupPropertiesForUpdate.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupPropertiesForUpdate.java new file mode 100644 index 0000000000000..b1a3d6040f794 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupPropertiesForUpdate.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.models.CitusVersion; +import com.azure.resourcemanager.postgresqlhsc.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlhsc.models.PostgreSqlVersion; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRoleGroup; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties used to update a server group. */ +@Fluent +public final class ServerGroupPropertiesForUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerGroupPropertiesForUpdate.class); + + /* + * The password of the administrator login. + */ + @JsonProperty(value = "administratorLoginPassword") + private String administratorLoginPassword; + + /* + * The backup retention days for server group. + */ + @JsonProperty(value = "backupRetentionDays") + private Integer backupRetentionDays; + + /* + * The PostgreSQL version of server group. + */ + @JsonProperty(value = "postgresqlVersion") + private PostgreSqlVersion postgresqlVersion; + + /* + * The Citus version of server group. + */ + @JsonProperty(value = "citusVersion") + private CitusVersion citusVersion; + + /* + * If shards on coordinator is enabled or not for the server group. + */ + @JsonProperty(value = "enableShardsOnCoordinator") + private Boolean enableShardsOnCoordinator; + + /* + * The list of server role groups. + */ + @JsonProperty(value = "serverRoleGroups") + private List serverRoleGroups; + + /* + * Maintenance window of a server group. + */ + @JsonProperty(value = "maintenanceWindow") + private MaintenanceWindow maintenanceWindow; + + /* + * Availability Zone information of the server group. + */ + @JsonProperty(value = "availabilityZone") + private String availabilityZone; + + /* + * Standby Availability Zone information of the server group. + */ + @JsonProperty(value = "standbyAvailabilityZone") + private String standbyAvailabilityZone; + + /** + * 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 ServerGroupPropertiesForUpdate object itself. + */ + public ServerGroupPropertiesForUpdate withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the backupRetentionDays property: The backup retention days for server group. + * + * @return the backupRetentionDays value. + */ + public Integer backupRetentionDays() { + return this.backupRetentionDays; + } + + /** + * Set the backupRetentionDays property: The backup retention days for server group. + * + * @param backupRetentionDays the backupRetentionDays value to set. + * @return the ServerGroupPropertiesForUpdate object itself. + */ + public ServerGroupPropertiesForUpdate withBackupRetentionDays(Integer backupRetentionDays) { + this.backupRetentionDays = backupRetentionDays; + return this; + } + + /** + * Get the postgresqlVersion property: The PostgreSQL version of server group. + * + * @return the postgresqlVersion value. + */ + public PostgreSqlVersion postgresqlVersion() { + return this.postgresqlVersion; + } + + /** + * Set the postgresqlVersion property: The PostgreSQL version of server group. + * + * @param postgresqlVersion the postgresqlVersion value to set. + * @return the ServerGroupPropertiesForUpdate object itself. + */ + public ServerGroupPropertiesForUpdate withPostgresqlVersion(PostgreSqlVersion postgresqlVersion) { + this.postgresqlVersion = postgresqlVersion; + return this; + } + + /** + * Get the citusVersion property: The Citus version of server group. + * + * @return the citusVersion value. + */ + public CitusVersion citusVersion() { + return this.citusVersion; + } + + /** + * Set the citusVersion property: The Citus version of server group. + * + * @param citusVersion the citusVersion value to set. + * @return the ServerGroupPropertiesForUpdate object itself. + */ + public ServerGroupPropertiesForUpdate withCitusVersion(CitusVersion citusVersion) { + this.citusVersion = citusVersion; + return this; + } + + /** + * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the server group. + * + * @return the enableShardsOnCoordinator value. + */ + public Boolean enableShardsOnCoordinator() { + return this.enableShardsOnCoordinator; + } + + /** + * Set the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the server group. + * + * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. + * @return the ServerGroupPropertiesForUpdate object itself. + */ + public ServerGroupPropertiesForUpdate withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) { + this.enableShardsOnCoordinator = enableShardsOnCoordinator; + return this; + } + + /** + * Get the serverRoleGroups property: The list of server role groups. + * + * @return the serverRoleGroups value. + */ + public List serverRoleGroups() { + return this.serverRoleGroups; + } + + /** + * Set the serverRoleGroups property: The list of server role groups. + * + * @param serverRoleGroups the serverRoleGroups value to set. + * @return the ServerGroupPropertiesForUpdate object itself. + */ + public ServerGroupPropertiesForUpdate withServerRoleGroups(List serverRoleGroups) { + this.serverRoleGroups = serverRoleGroups; + return this; + } + + /** + * Get the maintenanceWindow property: Maintenance window of a server group. + * + * @return the maintenanceWindow value. + */ + public MaintenanceWindow maintenanceWindow() { + return this.maintenanceWindow; + } + + /** + * Set the maintenanceWindow property: Maintenance window of a server group. + * + * @param maintenanceWindow the maintenanceWindow value to set. + * @return the ServerGroupPropertiesForUpdate object itself. + */ + public ServerGroupPropertiesForUpdate withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + this.maintenanceWindow = maintenanceWindow; + return this; + } + + /** + * Get the availabilityZone property: Availability Zone information of the server group. + * + * @return the availabilityZone value. + */ + public String availabilityZone() { + return this.availabilityZone; + } + + /** + * Set the availabilityZone property: Availability Zone information of the server group. + * + * @param availabilityZone the availabilityZone value to set. + * @return the ServerGroupPropertiesForUpdate object itself. + */ + public ServerGroupPropertiesForUpdate withAvailabilityZone(String availabilityZone) { + this.availabilityZone = availabilityZone; + return this; + } + + /** + * Get the standbyAvailabilityZone property: Standby Availability Zone information of the server group. + * + * @return the standbyAvailabilityZone value. + */ + public String standbyAvailabilityZone() { + return this.standbyAvailabilityZone; + } + + /** + * Set the standbyAvailabilityZone property: Standby Availability Zone information of the server group. + * + * @param standbyAvailabilityZone the standbyAvailabilityZone value to set. + * @return the ServerGroupPropertiesForUpdate object itself. + */ + public ServerGroupPropertiesForUpdate withStandbyAvailabilityZone(String standbyAvailabilityZone) { + this.standbyAvailabilityZone = standbyAvailabilityZone; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverRoleGroups() != null) { + serverRoleGroups().forEach(e -> e.validate()); + } + if (maintenanceWindow() != null) { + maintenanceWindow().validate(); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupServerInner.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupServerInner.java new file mode 100644 index 0000000000000..8bc7d7d6afff0 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupServerInner.java @@ -0,0 +1,331 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.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.postgresqlhsc.models.CitusVersion; +import com.azure.resourcemanager.postgresqlhsc.models.PostgreSqlVersion; +import com.azure.resourcemanager.postgresqlhsc.models.ServerEdition; +import com.azure.resourcemanager.postgresqlhsc.models.ServerHaState; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRole; +import com.azure.resourcemanager.postgresqlhsc.models.ServerState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a server in a server group. */ +@Fluent +public final class ServerGroupServerInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerGroupServerInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The properties of a server in a server group. + */ + @JsonProperty(value = "properties") + private ServerGroupServerProperties innerProperties; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: The properties of a server in a server group. + * + * @return the innerProperties value. + */ + private ServerGroupServerProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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 role property: The role of server in the server group. + * + * @return the role value. + */ + public ServerRole role() { + return this.innerProperties() == null ? null : this.innerProperties().role(); + } + + /** + * Set the role property: The role of server in the server group. + * + * @param role the role value to set. + * @return the ServerGroupServerInner object itself. + */ + public ServerGroupServerInner withRole(ServerRole role) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupServerProperties(); + } + this.innerProperties().withRole(role); + return this; + } + + /** + * 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 haState property: A state of a server group that is visible to user for HA feature. + * + * @return the haState value. + */ + public ServerHaState haState() { + return this.innerProperties() == null ? null : this.innerProperties().haState(); + } + + /** + * Get the administratorLogin property: The administrator's login name of a servers in server group. + * + * @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 servers in server group. + * + * @param administratorLogin the administratorLogin value to set. + * @return the ServerGroupServerInner object itself. + */ + public ServerGroupServerInner withAdministratorLogin(String administratorLogin) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupServerProperties(); + } + this.innerProperties().withAdministratorLogin(administratorLogin); + return this; + } + + /** + * Get the postgresqlVersion property: The PostgreSQL version of server. + * + * @return the postgresqlVersion value. + */ + public PostgreSqlVersion postgresqlVersion() { + return this.innerProperties() == null ? null : this.innerProperties().postgresqlVersion(); + } + + /** + * Set the postgresqlVersion property: The PostgreSQL version of server. + * + * @param postgresqlVersion the postgresqlVersion value to set. + * @return the ServerGroupServerInner object itself. + */ + public ServerGroupServerInner withPostgresqlVersion(PostgreSqlVersion postgresqlVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupServerProperties(); + } + this.innerProperties().withPostgresqlVersion(postgresqlVersion); + return this; + } + + /** + * Get the citusVersion property: The Citus version of server. + * + * @return the citusVersion value. + */ + public CitusVersion citusVersion() { + return this.innerProperties() == null ? null : this.innerProperties().citusVersion(); + } + + /** + * Set the citusVersion property: The Citus version of server. + * + * @param citusVersion the citusVersion value to set. + * @return the ServerGroupServerInner object itself. + */ + public ServerGroupServerInner withCitusVersion(CitusVersion citusVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupServerProperties(); + } + this.innerProperties().withCitusVersion(citusVersion); + return this; + } + + /** + * Get the availabilityZone property: Availability Zone information of the server group. + * + * @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 group. + * + * @param availabilityZone the availabilityZone value to set. + * @return the ServerGroupServerInner object itself. + */ + public ServerGroupServerInner withAvailabilityZone(String availabilityZone) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupServerProperties(); + } + this.innerProperties().withAvailabilityZone(availabilityZone); + return this; + } + + /** + * Get the standbyAvailabilityZone property: Standby Availability Zone information of the server group. + * + * @return the standbyAvailabilityZone value. + */ + public String standbyAvailabilityZone() { + return this.innerProperties() == null ? null : this.innerProperties().standbyAvailabilityZone(); + } + + /** + * Set the standbyAvailabilityZone property: Standby Availability Zone information of the server group. + * + * @param standbyAvailabilityZone the standbyAvailabilityZone value to set. + * @return the ServerGroupServerInner object itself. + */ + public ServerGroupServerInner withStandbyAvailabilityZone(String standbyAvailabilityZone) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupServerProperties(); + } + this.innerProperties().withStandbyAvailabilityZone(standbyAvailabilityZone); + return this; + } + + /** + * Get the serverEdition property: The edition of a server (default: GeneralPurpose). + * + * @return the serverEdition value. + */ + public ServerEdition serverEdition() { + return this.innerProperties() == null ? null : this.innerProperties().serverEdition(); + } + + /** + * Set the serverEdition property: The edition of a server (default: GeneralPurpose). + * + * @param serverEdition the serverEdition value to set. + * @return the ServerGroupServerInner object itself. + */ + public ServerGroupServerInner withServerEdition(ServerEdition serverEdition) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupServerProperties(); + } + this.innerProperties().withServerEdition(serverEdition); + return this; + } + + /** + * Get the storageQuotaInMb property: The storage of a server in MB (max: 2097152 = 2TiB). + * + * @return the storageQuotaInMb value. + */ + public Long storageQuotaInMb() { + return this.innerProperties() == null ? null : this.innerProperties().storageQuotaInMb(); + } + + /** + * Set the storageQuotaInMb property: The storage of a server in MB (max: 2097152 = 2TiB). + * + * @param storageQuotaInMb the storageQuotaInMb value to set. + * @return the ServerGroupServerInner object itself. + */ + public ServerGroupServerInner withStorageQuotaInMb(Long storageQuotaInMb) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupServerProperties(); + } + this.innerProperties().withStorageQuotaInMb(storageQuotaInMb); + return this; + } + + /** + * Get the vCores property: The vCores count of a server (max: 64). + * + * @return the vCores value. + */ + public Long vCores() { + return this.innerProperties() == null ? null : this.innerProperties().vCores(); + } + + /** + * Set the vCores property: The vCores count of a server (max: 64). + * + * @param vCores the vCores value to set. + * @return the ServerGroupServerInner object itself. + */ + public ServerGroupServerInner withVCores(Long vCores) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupServerProperties(); + } + this.innerProperties().withVCores(vCores); + return this; + } + + /** + * Get the enableHa property: If high availability is enabled or not for the server. + * + * @return the enableHa value. + */ + public Boolean enableHa() { + return this.innerProperties() == null ? null : this.innerProperties().enableHa(); + } + + /** + * Set the enableHa property: If high availability is enabled or not for the server. + * + * @param enableHa the enableHa value to set. + * @return the ServerGroupServerInner object itself. + */ + public ServerGroupServerInner withEnableHa(Boolean enableHa) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupServerProperties(); + } + this.innerProperties().withEnableHa(enableHa); + return this; + } + + /** + * Get the enablePublicIp property: If public IP is requested or not for a server. + * + * @return the enablePublicIp value. + */ + public Boolean enablePublicIp() { + return this.innerProperties() == null ? null : this.innerProperties().enablePublicIp(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupServerProperties.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupServerProperties.java new file mode 100644 index 0000000000000..c8344d3e02f4c --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerGroupServerProperties.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.models.CitusVersion; +import com.azure.resourcemanager.postgresqlhsc.models.PostgreSqlVersion; +import com.azure.resourcemanager.postgresqlhsc.models.ServerEdition; +import com.azure.resourcemanager.postgresqlhsc.models.ServerHaState; +import com.azure.resourcemanager.postgresqlhsc.models.ServerProperties; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRole; +import com.azure.resourcemanager.postgresqlhsc.models.ServerState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a server in server group. */ +@Fluent +public final class ServerGroupServerProperties extends ServerProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerGroupServerProperties.class); + + /* + * The fully qualified domain name of a server. + */ + @JsonProperty(value = "fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /* + * The role of server in the server group. + */ + @JsonProperty(value = "role") + private ServerRole role; + + /* + * A state of a server that is visible to user. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private ServerState state; + + /* + * A state of a server group that is visible to user for HA feature. + */ + @JsonProperty(value = "haState", access = JsonProperty.Access.WRITE_ONLY) + private ServerHaState haState; + + /* + * The administrator's login name of a servers in server group. + */ + @JsonProperty(value = "administratorLogin") + private String administratorLogin; + + /* + * The PostgreSQL version of server. + */ + @JsonProperty(value = "postgresqlVersion") + private PostgreSqlVersion postgresqlVersion; + + /* + * The Citus version of server. + */ + @JsonProperty(value = "citusVersion") + private CitusVersion citusVersion; + + /* + * Availability Zone information of the server group. + */ + @JsonProperty(value = "availabilityZone") + private String availabilityZone; + + /* + * Standby Availability Zone information of the server group. + */ + @JsonProperty(value = "standbyAvailabilityZone") + private String standbyAvailabilityZone; + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Get the role property: The role of server in the server group. + * + * @return the role value. + */ + public ServerRole role() { + return this.role; + } + + /** + * Set the role property: The role of server in the server group. + * + * @param role the role value to set. + * @return the ServerGroupServerProperties object itself. + */ + public ServerGroupServerProperties withRole(ServerRole role) { + this.role = role; + return this; + } + + /** + * 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 haState property: A state of a server group that is visible to user for HA feature. + * + * @return the haState value. + */ + public ServerHaState haState() { + return this.haState; + } + + /** + * Get the administratorLogin property: The administrator's login name of a servers in server group. + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: The administrator's login name of a servers in server group. + * + * @param administratorLogin the administratorLogin value to set. + * @return the ServerGroupServerProperties object itself. + */ + public ServerGroupServerProperties withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the postgresqlVersion property: The PostgreSQL version of server. + * + * @return the postgresqlVersion value. + */ + public PostgreSqlVersion postgresqlVersion() { + return this.postgresqlVersion; + } + + /** + * Set the postgresqlVersion property: The PostgreSQL version of server. + * + * @param postgresqlVersion the postgresqlVersion value to set. + * @return the ServerGroupServerProperties object itself. + */ + public ServerGroupServerProperties withPostgresqlVersion(PostgreSqlVersion postgresqlVersion) { + this.postgresqlVersion = postgresqlVersion; + return this; + } + + /** + * Get the citusVersion property: The Citus version of server. + * + * @return the citusVersion value. + */ + public CitusVersion citusVersion() { + return this.citusVersion; + } + + /** + * Set the citusVersion property: The Citus version of server. + * + * @param citusVersion the citusVersion value to set. + * @return the ServerGroupServerProperties object itself. + */ + public ServerGroupServerProperties withCitusVersion(CitusVersion citusVersion) { + this.citusVersion = citusVersion; + return this; + } + + /** + * Get the availabilityZone property: Availability Zone information of the server group. + * + * @return the availabilityZone value. + */ + public String availabilityZone() { + return this.availabilityZone; + } + + /** + * Set the availabilityZone property: Availability Zone information of the server group. + * + * @param availabilityZone the availabilityZone value to set. + * @return the ServerGroupServerProperties object itself. + */ + public ServerGroupServerProperties withAvailabilityZone(String availabilityZone) { + this.availabilityZone = availabilityZone; + return this; + } + + /** + * Get the standbyAvailabilityZone property: Standby Availability Zone information of the server group. + * + * @return the standbyAvailabilityZone value. + */ + public String standbyAvailabilityZone() { + return this.standbyAvailabilityZone; + } + + /** + * Set the standbyAvailabilityZone property: Standby Availability Zone information of the server group. + * + * @param standbyAvailabilityZone the standbyAvailabilityZone value to set. + * @return the ServerGroupServerProperties object itself. + */ + public ServerGroupServerProperties withStandbyAvailabilityZone(String standbyAvailabilityZone) { + this.standbyAvailabilityZone = standbyAvailabilityZone; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerGroupServerProperties withServerEdition(ServerEdition serverEdition) { + super.withServerEdition(serverEdition); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerGroupServerProperties withStorageQuotaInMb(Long storageQuotaInMb) { + super.withStorageQuotaInMb(storageQuotaInMb); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerGroupServerProperties withVCores(Long vCores) { + super.withVCores(vCores); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerGroupServerProperties withEnableHa(Boolean enableHa) { + super.withEnableHa(enableHa); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/package-info.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/package-info.java new file mode 100644 index 0000000000000..d1567ccf7b143 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/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 MicrosoftPostgreSqlHyperscale. The Microsoft Azure management API + * provides create, read, update, and delete functionality for Azure PostgreSQL Hyperscale (Citus) resources including + * server groups, servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations. + */ +package com.azure.resourcemanager.postgresqlhsc.fluent.models; diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/package-info.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/package-info.java new file mode 100644 index 0000000000000..523ce5a767806 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/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 MicrosoftPostgreSqlHyperscale. The Microsoft Azure management API provides + * create, read, update, and delete functionality for Azure PostgreSQL Hyperscale (Citus) resources including server + * groups, servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations. + */ +package com.azure.resourcemanager.postgresqlhsc.fluent; diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ConfigurationsClientImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ConfigurationsClientImpl.java new file mode 100644 index 0000000000000..aeb2f4cf61bca --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ConfigurationsClientImpl.java @@ -0,0 +1,1178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.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.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.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlhsc.fluent.ConfigurationsClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationInner; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupConfigurationInner; +import com.azure.resourcemanager.postgresqlhsc.models.ServerConfigurationListResult; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupConfigurationListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ConfigurationsClient. */ +public final class ConfigurationsClientImpl implements ConfigurationsClient { + private final ClientLogger logger = new ClientLogger(ConfigurationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ConfigurationsService service; + + /** The service client containing this operation class. */ + private final MicrosoftPostgreSqlHyperscaleImpl client; + + /** + * Initializes an instance of ConfigurationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ConfigurationsClientImpl(MicrosoftPostgreSqlHyperscaleImpl client) { + this.service = + RestProxy.create(ConfigurationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftPostgreSqlHyperscaleConfigurations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftPostgreSqlH") + private interface ConfigurationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}/servers/{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("serverGroupName") String serverGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}/configurations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverGroupName") String serverGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}/configurations/{configurationName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverGroupName") String serverGroupName, + @PathParam("configurationName") String configurationName, + @BodyParam("application/json") ServerGroupConfigurationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}/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("serverGroupName") String serverGroupName, + @PathParam("configurationName") String configurationName, + @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); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the configurations of a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + 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 of a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the configurations of a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * List all the configurations of a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the configurations of a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverGroupName, serverName)); + } + + /** + * List all the configurations of a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverGroupName, serverName, context)); + } + + /** + * List all the configurations of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 group configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerGroupSinglePageAsync( + String resourceGroupName, String serverGroupName) { + 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServerGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverGroupName, + 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 of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 group configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerGroupSinglePageAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the configurations of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 group configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerGroupAsync( + String resourceGroupName, String serverGroupName) { + return new PagedFlux<>( + () -> listByServerGroupSinglePageAsync(resourceGroupName, serverGroupName), + nextLink -> listByServerGroupNextSinglePageAsync(nextLink)); + } + + /** + * List all the configurations of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 group configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerGroupAsync( + String resourceGroupName, String serverGroupName, Context context) { + return new PagedFlux<>( + () -> listByServerGroupSinglePageAsync(resourceGroupName, serverGroupName, context), + nextLink -> listByServerGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the configurations of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 group configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServerGroup( + String resourceGroupName, String serverGroupName) { + return new PagedIterable<>(listByServerGroupAsync(resourceGroupName, serverGroupName)); + } + + /** + * List all the configurations of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 group configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServerGroup( + String resourceGroupName, String serverGroupName, Context context) { + return new PagedIterable<>(listByServerGroupAsync(resourceGroupName, serverGroupName, context)); + } + + /** + * Updates configuration of server role groups in a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group configuration. + * @param parameters The required parameters for updating a server group 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 the configuration list of server role groups in a server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + configurationName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates configuration of server role groups in a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group configuration. + * @param parameters The required parameters for updating a server group 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 the configuration list of server role groups in a server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + configurationName, + parameters, + accept, + context); + } + + /** + * Updates configuration of server role groups in a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group configuration. + * @param parameters The required parameters for updating a server group 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 the configuration list of server role groups in a server group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerGroupConfigurationInner> beginUpdateAsync( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverGroupName, configurationName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerGroupConfigurationInner.class, + ServerGroupConfigurationInner.class, + this.client.getContext()); + } + + /** + * Updates configuration of server role groups in a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group configuration. + * @param parameters The required parameters for updating a server group 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 the configuration list of server role groups in a server group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerGroupConfigurationInner> beginUpdateAsync( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverGroupName, configurationName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerGroupConfigurationInner.class, + ServerGroupConfigurationInner.class, + context); + } + + /** + * Updates configuration of server role groups in a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group configuration. + * @param parameters The required parameters for updating a server group 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 the configuration list of server role groups in a server group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerGroupConfigurationInner> beginUpdate( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner parameters) { + return beginUpdateAsync(resourceGroupName, serverGroupName, configurationName, parameters).getSyncPoller(); + } + + /** + * Updates configuration of server role groups in a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group configuration. + * @param parameters The required parameters for updating a server group 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 the configuration list of server role groups in a server group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerGroupConfigurationInner> beginUpdate( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverGroupName, configurationName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates configuration of server role groups in a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group configuration. + * @param parameters The required parameters for updating a server group 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 the configuration list of server role groups in a server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner parameters) { + return beginUpdateAsync(resourceGroupName, serverGroupName, configurationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates configuration of server role groups in a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group configuration. + * @param parameters The required parameters for updating a server group 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 the configuration list of server role groups in a server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverGroupName, configurationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates configuration of server role groups in a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group configuration. + * @param parameters The required parameters for updating a server group 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 the configuration list of server role groups in a server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerGroupConfigurationInner update( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner parameters) { + return updateAsync(resourceGroupName, serverGroupName, configurationName, parameters).block(); + } + + /** + * Updates configuration of server role groups in a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group configuration. + * @param parameters The required parameters for updating a server group 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 the configuration list of server role groups in a server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerGroupConfigurationInner update( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner parameters, + Context context) { + return updateAsync(resourceGroupName, serverGroupName, configurationName, parameters, context).block(); + } + + /** + * Gets information about single server group configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group 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 single server group configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + configurationName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about single server group configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group 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 single server group configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + configurationName, + accept, + context); + } + + /** + * Gets information about single server group configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group 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 single server group configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverGroupName, String configurationName) { + return getWithResponseAsync(resourceGroupName, serverGroupName, configurationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about single server group configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group 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 single server group configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerGroupConfigurationInner get( + String resourceGroupName, String serverGroupName, String configurationName) { + return getAsync(resourceGroupName, serverGroupName, configurationName).block(); + } + + /** + * Gets information about single server group configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group 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 single server group configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverGroupName, String configurationName, Context context) { + return getWithResponseAsync(resourceGroupName, serverGroupName, configurationName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @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)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server group configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerGroupNextSinglePageAsync(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.listByServerGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server group configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerGroupNextSinglePageAsync( + 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 + .listByServerGroupNext(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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ConfigurationsImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ConfigurationsImpl.java new file mode 100644 index 0000000000000..239b9dc35d37c --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ConfigurationsImpl.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.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.postgresqlhsc.fluent.ConfigurationsClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationInner; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupConfigurationInner; +import com.azure.resourcemanager.postgresqlhsc.models.Configurations; +import com.azure.resourcemanager.postgresqlhsc.models.ServerConfiguration; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupConfiguration; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ConfigurationsImpl implements Configurations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationsImpl.class); + + private final ConfigurationsClient innerClient; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + public ConfigurationsImpl( + ConfigurationsClient innerClient, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer( + String resourceGroupName, String serverGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerConfigurationImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerConfigurationImpl(inner1, this.manager())); + } + + public PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName) { + PagedIterable inner = + this.serviceClient().listByServerGroup(resourceGroupName, serverGroupName); + return Utils.mapPage(inner, inner1 -> new ServerGroupConfigurationImpl(inner1, this.manager())); + } + + public PagedIterable listByServerGroup( + String resourceGroupName, String serverGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByServerGroup(resourceGroupName, serverGroupName, context); + return Utils.mapPage(inner, inner1 -> new ServerGroupConfigurationImpl(inner1, this.manager())); + } + + public ServerGroupConfiguration update( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner parameters) { + ServerGroupConfigurationInner inner = + this.serviceClient().update(resourceGroupName, serverGroupName, configurationName, parameters); + if (inner != null) { + return new ServerGroupConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerGroupConfiguration update( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner parameters, + Context context) { + ServerGroupConfigurationInner inner = + this.serviceClient().update(resourceGroupName, serverGroupName, configurationName, parameters, context); + if (inner != null) { + return new ServerGroupConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerGroupConfiguration get(String resourceGroupName, String serverGroupName, String configurationName) { + ServerGroupConfigurationInner inner = + this.serviceClient().get(resourceGroupName, serverGroupName, configurationName); + if (inner != null) { + return new ServerGroupConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverGroupName, String configurationName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverGroupName, configurationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerGroupConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ConfigurationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/FirewallRuleImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/FirewallRuleImpl.java new file mode 100644 index 0000000000000..24392cfe6ae0f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/FirewallRuleImpl.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.postgresqlhsc.models.FirewallRule; + +public final class FirewallRuleImpl implements FirewallRule, FirewallRule.Definition, FirewallRule.Update { + private FirewallRuleInner innerObject; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager 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 FirewallRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverGroupName; + + private String firewallRuleName; + + public FirewallRuleImpl withExistingServerGroupsv2(String resourceGroupName, String serverGroupName) { + this.resourceGroupName = resourceGroupName; + this.serverGroupName = serverGroupName; + return this; + } + + public FirewallRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, serverGroupName, firewallRuleName, this.innerModel(), Context.NONE); + return this; + } + + public FirewallRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, serverGroupName, firewallRuleName, this.innerModel(), context); + return this; + } + + FirewallRuleImpl(String name, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager 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, serverGroupName, firewallRuleName, this.innerModel(), Context.NONE); + return this; + } + + public FirewallRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, serverGroupName, firewallRuleName, this.innerModel(), context); + return this; + } + + FirewallRuleImpl( + FirewallRuleInner innerObject, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverGroupName = Utils.getValueFromIdByName(innerObject.id(), "serverGroupsv2"); + this.firewallRuleName = Utils.getValueFromIdByName(innerObject.id(), "firewallRules"); + } + + public FirewallRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .getWithResponse(resourceGroupName, serverGroupName, firewallRuleName, Context.NONE) + .getValue(); + return this; + } + + public FirewallRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .getWithResponse(resourceGroupName, serverGroupName, 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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/FirewallRulesClientImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/FirewallRulesClientImpl.java new file mode 100644 index 0000000000000..35f3cb4876723 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/FirewallRulesClientImpl.java @@ -0,0 +1,1037 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.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.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlhsc.fluent.FirewallRulesClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.postgresqlhsc.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 { + private final ClientLogger logger = new ClientLogger(FirewallRulesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final FirewallRulesService service; + + /** The service client containing this operation class. */ + private final MicrosoftPostgreSqlHyperscaleImpl client; + + /** + * Initializes an instance of FirewallRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FirewallRulesClientImpl(MicrosoftPostgreSqlHyperscaleImpl client) { + this.service = + RestProxy.create(FirewallRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftPostgreSqlHyperscaleFirewallRules to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftPostgreSqlH") + private interface FirewallRulesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}/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("serverGroupName") String serverGroupName, + @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" + + "/serverGroupsv2/{serverGroupName}/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("serverGroupName") String serverGroupName, + @PathParam("firewallRuleName") String firewallRuleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}/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("serverGroupName") String serverGroupName, + @PathParam("firewallRuleName") String firewallRuleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}/firewallRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverGroupName") String serverGroupName, + @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 serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 group firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + 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 serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 group firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverGroupName, + 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + 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 serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 group firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverGroupName, String firewallRuleName, FirewallRuleInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverGroupName, 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 serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 group firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverGroupName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverGroupName, 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 serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 group firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, String serverGroupName, String firewallRuleName, FirewallRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverGroupName, 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 serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 group firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverGroupName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverGroupName, 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 serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 group firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverGroupName, String firewallRuleName, FirewallRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverGroupName, 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 serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 group firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverGroupName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverGroupName, 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 serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 group firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner createOrUpdate( + String resourceGroupName, String serverGroupName, String firewallRuleName, FirewallRuleInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverGroupName, 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 serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 group firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner createOrUpdate( + String resourceGroupName, + String serverGroupName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverGroupName, firewallRuleName, parameters, context).block(); + } + + /** + * Deletes a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + firewallRuleName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + firewallRuleName, + accept, + context); + } + + /** + * Deletes a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverGroupName, String firewallRuleName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverGroupName, firewallRuleName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverGroupName, String firewallRuleName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverGroupName, firewallRuleName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverGroupName, String firewallRuleName) { + return beginDeleteAsync(resourceGroupName, serverGroupName, firewallRuleName).getSyncPoller(); + } + + /** + * Deletes a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverGroupName, String firewallRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverGroupName, firewallRuleName, context).getSyncPoller(); + } + + /** + * Deletes a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverGroupName, String firewallRuleName) { + return beginDeleteAsync(resourceGroupName, serverGroupName, firewallRuleName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverGroupName, String firewallRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverGroupName, firewallRuleName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 serverGroupName, String firewallRuleName) { + deleteAsync(resourceGroupName, serverGroupName, firewallRuleName).block(); + } + + /** + * Deletes a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 serverGroupName, String firewallRuleName, Context context) { + deleteAsync(resourceGroupName, serverGroupName, firewallRuleName, context).block(); + } + + /** + * Gets information about a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 information about a server group firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + firewallRuleName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 information about a server group firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + firewallRuleName, + accept, + context); + } + + /** + * Gets information about a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 information about a server group firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverGroupName, String firewallRuleName) { + return getWithResponseAsync(resourceGroupName, serverGroupName, firewallRuleName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 information about a server group firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner get(String resourceGroupName, String serverGroupName, String firewallRuleName) { + return getAsync(resourceGroupName, serverGroupName, firewallRuleName).block(); + } + + /** + * Gets information about a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 information about a server group firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverGroupName, String firewallRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, serverGroupName, firewallRuleName, context).block(); + } + + /** + * List all the firewall rules in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerGroupSinglePageAsync( + String resourceGroupName, String serverGroupName) { + 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServerGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverGroupName, + 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 firewall rules in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerGroupSinglePageAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the firewall rules in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerGroupAsync(String resourceGroupName, String serverGroupName) { + return new PagedFlux<>(() -> listByServerGroupSinglePageAsync(resourceGroupName, serverGroupName)); + } + + /** + * List all the firewall rules in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerGroupAsync( + String resourceGroupName, String serverGroupName, Context context) { + return new PagedFlux<>(() -> listByServerGroupSinglePageAsync(resourceGroupName, serverGroupName, context)); + } + + /** + * List all the firewall rules in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName) { + return new PagedIterable<>(listByServerGroupAsync(resourceGroupName, serverGroupName)); + } + + /** + * List all the firewall rules in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServerGroup( + String resourceGroupName, String serverGroupName, Context context) { + return new PagedIterable<>(listByServerGroupAsync(resourceGroupName, serverGroupName, context)); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/FirewallRulesImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/FirewallRulesImpl.java new file mode 100644 index 0000000000000..9d4810015cb77 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/FirewallRulesImpl.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.postgresqlhsc.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.postgresqlhsc.fluent.FirewallRulesClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.postgresqlhsc.models.FirewallRule; +import com.azure.resourcemanager.postgresqlhsc.models.FirewallRules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class FirewallRulesImpl implements FirewallRules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FirewallRulesImpl.class); + + private final FirewallRulesClient innerClient; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + public FirewallRulesImpl( + FirewallRulesClient innerClient, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String serverGroupName, String firewallRuleName) { + this.serviceClient().delete(resourceGroupName, serverGroupName, firewallRuleName); + } + + public void delete(String resourceGroupName, String serverGroupName, String firewallRuleName, Context context) { + this.serviceClient().delete(resourceGroupName, serverGroupName, firewallRuleName, context); + } + + public FirewallRule get(String resourceGroupName, String serverGroupName, String firewallRuleName) { + FirewallRuleInner inner = this.serviceClient().get(resourceGroupName, serverGroupName, firewallRuleName); + if (inner != null) { + return new FirewallRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverGroupName, String firewallRuleName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverGroupName, firewallRuleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FirewallRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName) { + PagedIterable inner = + this.serviceClient().listByServerGroup(resourceGroupName, serverGroupName); + return Utils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByServerGroup( + String resourceGroupName, String serverGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByServerGroup(resourceGroupName, serverGroupName, 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 serverGroupName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (serverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", 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, serverGroupName, 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 serverGroupName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (serverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", 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, serverGroupName, 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 serverGroupName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (serverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", 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, serverGroupName, 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 serverGroupName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (serverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", 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, serverGroupName, firewallRuleName, context); + } + + private FirewallRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } + + public FirewallRuleImpl define(String name) { + return new FirewallRuleImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/MicrosoftPostgreSqlHyperscaleBuilder.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/MicrosoftPostgreSqlHyperscaleBuilder.java new file mode 100644 index 0000000000000..0007d8332bab7 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/MicrosoftPostgreSqlHyperscaleBuilder.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.postgresqlhsc.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.CookiePolicy; +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 MicrosoftPostgreSqlHyperscaleImpl type. */ +@ServiceClientBuilder(serviceClients = {MicrosoftPostgreSqlHyperscaleImpl.class}) +public final class MicrosoftPostgreSqlHyperscaleBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the MicrosoftPostgreSqlHyperscaleBuilder. + */ + public MicrosoftPostgreSqlHyperscaleBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MicrosoftPostgreSqlHyperscaleBuilder. + */ + public MicrosoftPostgreSqlHyperscaleBuilder 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 MicrosoftPostgreSqlHyperscaleBuilder. + */ + public MicrosoftPostgreSqlHyperscaleBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 MicrosoftPostgreSqlHyperscaleBuilder. + */ + public MicrosoftPostgreSqlHyperscaleBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 MicrosoftPostgreSqlHyperscaleBuilder. + */ + public MicrosoftPostgreSqlHyperscaleBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + 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 MicrosoftPostgreSqlHyperscaleBuilder. + */ + public MicrosoftPostgreSqlHyperscaleBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MicrosoftPostgreSqlHyperscaleImpl with the provided parameters. + * + * @return an instance of MicrosoftPostgreSqlHyperscaleImpl. + */ + public MicrosoftPostgreSqlHyperscaleImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + MicrosoftPostgreSqlHyperscaleImpl client = + new MicrosoftPostgreSqlHyperscaleImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/MicrosoftPostgreSqlHyperscaleImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/MicrosoftPostgreSqlHyperscaleImpl.java new file mode 100644 index 0000000000000..53d9c2a1f8f62 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/MicrosoftPostgreSqlHyperscaleImpl.java @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.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.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.postgresqlhsc.fluent.ConfigurationsClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.FirewallRulesClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.MicrosoftPostgreSqlHyperscale; +import com.azure.resourcemanager.postgresqlhsc.fluent.OperationsClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.RolesClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.ServerGroupsClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.ServersClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the MicrosoftPostgreSqlHyperscaleImpl type. */ +@ServiceClient(builder = MicrosoftPostgreSqlHyperscaleBuilder.class) +public final class MicrosoftPostgreSqlHyperscaleImpl implements MicrosoftPostgreSqlHyperscale { + private final ClientLogger logger = new ClientLogger(MicrosoftPostgreSqlHyperscaleImpl.class); + + /** 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 ServerGroupsClient object to access its operations. */ + private final ServerGroupsClient serverGroups; + + /** + * Gets the ServerGroupsClient object to access its operations. + * + * @return the ServerGroupsClient object. + */ + public ServerGroupsClient getServerGroups() { + return this.serverGroups; + } + + /** 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 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 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 RolesClient object to access its operations. */ + private final RolesClient roles; + + /** + * Gets the RolesClient object to access its operations. + * + * @return the RolesClient object. + */ + public RolesClient getRoles() { + return this.roles; + } + + /** 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; + } + + /** + * Initializes an instance of MicrosoftPostgreSqlHyperscale 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. + */ + MicrosoftPostgreSqlHyperscaleImpl( + 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 = "2020-10-05-privatepreview"; + this.serverGroups = new ServerGroupsClientImpl(this); + this.servers = new ServersClientImpl(this); + this.configurations = new ConfigurationsClientImpl(this); + this.firewallRules = new FirewallRulesClientImpl(this); + this.roles = new RolesClientImpl(this); + this.operations = new OperationsClientImpl(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) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return 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)); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/NameAvailabilityImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/NameAvailabilityImpl.java new file mode 100644 index 0000000000000..ca8f36c0a0479 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/NameAvailabilityImpl.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.postgresqlhsc.implementation; + +import com.azure.resourcemanager.postgresqlhsc.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.postgresqlhsc.models.NameAvailability; + +public final class NameAvailabilityImpl implements NameAvailability { + private NameAvailabilityInner innerObject; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + NameAvailabilityImpl( + NameAvailabilityInner innerObject, + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String message() { + return this.innerModel().message(); + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public NameAvailabilityInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/OperationImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/OperationImpl.java new file mode 100644 index 0000000000000..facda7d99c719 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/OperationImpl.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.postgresqlhsc.implementation; + +import com.azure.resourcemanager.postgresqlhsc.fluent.models.OperationInner; +import com.azure.resourcemanager.postgresqlhsc.models.Operation; +import com.azure.resourcemanager.postgresqlhsc.models.OperationDisplay; +import com.azure.resourcemanager.postgresqlhsc.models.OperationOrigin; +import java.util.Collections; +import java.util.Map; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationOrigin origin() { + return this.innerModel().origin(); + } + + public Map properties() { + Map inner = this.innerModel().properties(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/OperationsClientImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..54f1db5b4a34d --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/OperationsClientImpl.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.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.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.fluent.OperationsClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.OperationInner; +import com.azure.resourcemanager.postgresqlhsc.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final MicrosoftPostgreSqlHyperscaleImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MicrosoftPostgreSqlHyperscaleImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftPostgreSqlHyperscaleOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftPostgreSqlH") + private 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. + */ + @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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .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. + */ + @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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists all of the available REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Lists all of the available REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(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 ManagementException thrown if 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.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/OperationsImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..fb25624633cce --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.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.postgresqlhsc.fluent.OperationsClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.OperationInner; +import com.azure.resourcemanager.postgresqlhsc.models.Operation; +import com.azure.resourcemanager.postgresqlhsc.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/RoleImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/RoleImpl.java new file mode 100644 index 0000000000000..73f04ecc12531 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/RoleImpl.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.RoleInner; +import com.azure.resourcemanager.postgresqlhsc.models.Role; + +public final class RoleImpl implements Role, Role.Definition { + private RoleInner innerObject; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + RoleImpl(RoleInner innerObject, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager 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 password() { + return this.innerModel().password(); + } + + public RoleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverGroupName; + + private String roleName; + + public RoleImpl withExistingServerGroupsv2(String resourceGroupName, String serverGroupName) { + this.resourceGroupName = resourceGroupName; + this.serverGroupName = serverGroupName; + return this; + } + + public Role create() { + this.innerObject = + serviceManager + .serviceClient() + .getRoles() + .create(resourceGroupName, serverGroupName, roleName, this.innerModel(), Context.NONE); + return this; + } + + public Role create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRoles() + .create(resourceGroupName, serverGroupName, roleName, this.innerModel(), context); + return this; + } + + RoleImpl(String name, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerObject = new RoleInner(); + this.serviceManager = serviceManager; + this.roleName = name; + } + + public RoleImpl withPassword(String password) { + this.innerModel().withPassword(password); + return this; + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/RolesClientImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/RolesClientImpl.java new file mode 100644 index 0000000000000..31e44cbfe9851 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/RolesClientImpl.java @@ -0,0 +1,820 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.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.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlhsc.fluent.RolesClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.RoleInner; +import com.azure.resourcemanager.postgresqlhsc.models.RoleListResult; +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 RolesClient. */ +public final class RolesClientImpl implements RolesClient { + private final ClientLogger logger = new ClientLogger(RolesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RolesService service; + + /** The service client containing this operation class. */ + private final MicrosoftPostgreSqlHyperscaleImpl client; + + /** + * Initializes an instance of RolesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RolesClientImpl(MicrosoftPostgreSqlHyperscaleImpl client) { + this.service = RestProxy.create(RolesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftPostgreSqlHyperscaleRoles to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftPostgreSqlH") + private interface RolesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}/roles/{roleName}") + @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("serverGroupName") String serverGroupName, + @PathParam("roleName") String roleName, + @BodyParam("application/json") RoleInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}/roles/{roleName}") + @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("serverGroupName") String serverGroupName, + @PathParam("roleName") String roleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}/roles") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverGroupName") String serverGroupName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a new role or updates an existing role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param parameters The required parameters for creating or updating a role. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group role. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String serverGroupName, String roleName, RoleInner 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName is required and cannot be null.")); + } + if (roleName == null) { + return Mono.error(new IllegalArgumentException("Parameter roleName 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, + serverGroupName, + roleName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new role or updates an existing role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param parameters The required parameters for creating or updating a role. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group role. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String serverGroupName, String roleName, RoleInner 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName is required and cannot be null.")); + } + if (roleName == null) { + return Mono.error(new IllegalArgumentException("Parameter roleName 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, + serverGroupName, + roleName, + parameters, + accept, + context); + } + + /** + * Creates a new role or updates an existing role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param parameters The required parameters for creating or updating a role. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group role. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RoleInner> beginCreateAsync( + String resourceGroupName, String serverGroupName, String roleName, RoleInner parameters) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverGroupName, roleName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), RoleInner.class, RoleInner.class, this.client.getContext()); + } + + /** + * Creates a new role or updates an existing role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param parameters The required parameters for creating or updating a role. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group role. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RoleInner> beginCreateAsync( + String resourceGroupName, String serverGroupName, String roleName, RoleInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverGroupName, roleName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), RoleInner.class, RoleInner.class, context); + } + + /** + * Creates a new role or updates an existing role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param parameters The required parameters for creating or updating a role. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group role. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RoleInner> beginCreate( + String resourceGroupName, String serverGroupName, String roleName, RoleInner parameters) { + return beginCreateAsync(resourceGroupName, serverGroupName, roleName, parameters).getSyncPoller(); + } + + /** + * Creates a new role or updates an existing role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param parameters The required parameters for creating or updating a role. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group role. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RoleInner> beginCreate( + String resourceGroupName, String serverGroupName, String roleName, RoleInner parameters, Context context) { + return beginCreateAsync(resourceGroupName, serverGroupName, roleName, parameters, context).getSyncPoller(); + } + + /** + * Creates a new role or updates an existing role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param parameters The required parameters for creating or updating a role. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group role. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String serverGroupName, String roleName, RoleInner parameters) { + return beginCreateAsync(resourceGroupName, serverGroupName, roleName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new role or updates an existing role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param parameters The required parameters for creating or updating a role. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group role. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String serverGroupName, String roleName, RoleInner parameters, Context context) { + return beginCreateAsync(resourceGroupName, serverGroupName, roleName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new role or updates an existing role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param parameters The required parameters for creating or updating a role. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group role. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleInner create(String resourceGroupName, String serverGroupName, String roleName, RoleInner parameters) { + return createAsync(resourceGroupName, serverGroupName, roleName, parameters).block(); + } + + /** + * Creates a new role or updates an existing role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param parameters The required parameters for creating or updating a role. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group role. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleInner create( + String resourceGroupName, String serverGroupName, String roleName, RoleInner parameters, Context context) { + return createAsync(resourceGroupName, serverGroupName, roleName, parameters, context).block(); + } + + /** + * Deletes a server group role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverGroupName, String roleName) { + 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName is required and cannot be null.")); + } + if (roleName == null) { + return Mono.error(new IllegalArgumentException("Parameter roleName 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, + serverGroupName, + roleName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a server group role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverGroupName, String roleName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName is required and cannot be null.")); + } + if (roleName == null) { + return Mono.error(new IllegalArgumentException("Parameter roleName 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, + serverGroupName, + roleName, + accept, + context); + } + + /** + * Deletes a server group role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverGroupName, String roleName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverGroupName, roleName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a server group role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverGroupName, String roleName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverGroupName, roleName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a server group role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverGroupName, String roleName) { + return beginDeleteAsync(resourceGroupName, serverGroupName, roleName).getSyncPoller(); + } + + /** + * Deletes a server group role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverGroupName, String roleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverGroupName, roleName, context).getSyncPoller(); + } + + /** + * Deletes a server group role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverGroupName, String roleName) { + return beginDeleteAsync(resourceGroupName, serverGroupName, roleName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server group role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverGroupName, String roleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverGroupName, roleName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server group role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverGroupName, String roleName) { + deleteAsync(resourceGroupName, serverGroupName, roleName).block(); + } + + /** + * Deletes a server group role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverGroupName, String roleName, Context context) { + deleteAsync(resourceGroupName, serverGroupName, roleName, context).block(); + } + + /** + * List all the roles in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of roles. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerGroupSinglePageAsync( + String resourceGroupName, String serverGroupName) { + 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServerGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverGroupName, + 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 roles in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of roles. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerGroupSinglePageAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the roles in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of roles. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerGroupAsync(String resourceGroupName, String serverGroupName) { + return new PagedFlux<>(() -> listByServerGroupSinglePageAsync(resourceGroupName, serverGroupName)); + } + + /** + * List all the roles in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of roles. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerGroupAsync( + String resourceGroupName, String serverGroupName, Context context) { + return new PagedFlux<>(() -> listByServerGroupSinglePageAsync(resourceGroupName, serverGroupName, context)); + } + + /** + * List all the roles in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of roles. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName) { + return new PagedIterable<>(listByServerGroupAsync(resourceGroupName, serverGroupName)); + } + + /** + * List all the roles in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of roles. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServerGroup( + String resourceGroupName, String serverGroupName, Context context) { + return new PagedIterable<>(listByServerGroupAsync(resourceGroupName, serverGroupName, context)); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/RolesImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/RolesImpl.java new file mode 100644 index 0000000000000..d7e1272109c83 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/RolesImpl.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.postgresqlhsc.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.postgresqlhsc.fluent.RolesClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.RoleInner; +import com.azure.resourcemanager.postgresqlhsc.models.Role; +import com.azure.resourcemanager.postgresqlhsc.models.Roles; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RolesImpl implements Roles { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RolesImpl.class); + + private final RolesClient innerClient; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + public RolesImpl( + RolesClient innerClient, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String serverGroupName, String roleName) { + this.serviceClient().delete(resourceGroupName, serverGroupName, roleName); + } + + public void delete(String resourceGroupName, String serverGroupName, String roleName, Context context) { + this.serviceClient().delete(resourceGroupName, serverGroupName, roleName, context); + } + + public PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName) { + PagedIterable inner = this.serviceClient().listByServerGroup(resourceGroupName, serverGroupName); + return Utils.mapPage(inner, inner1 -> new RoleImpl(inner1, this.manager())); + } + + public PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByServerGroup(resourceGroupName, serverGroupName, context); + return Utils.mapPage(inner, inner1 -> new RoleImpl(inner1, this.manager())); + } + + 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 serverGroupName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (serverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", id))); + } + String roleName = Utils.getValueFromIdByName(id, "roles"); + if (roleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'roles'.", id))); + } + this.delete(resourceGroupName, serverGroupName, roleName, 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 serverGroupName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (serverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", id))); + } + String roleName = Utils.getValueFromIdByName(id, "roles"); + if (roleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'roles'.", id))); + } + this.delete(resourceGroupName, serverGroupName, roleName, context); + } + + private RolesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } + + public RoleImpl define(String name) { + return new RoleImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerConfigurationImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerConfigurationImpl.java new file mode 100644 index 0000000000000..64e2b0d993674 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerConfigurationImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationInner; +import com.azure.resourcemanager.postgresqlhsc.models.ConfigurationDataType; +import com.azure.resourcemanager.postgresqlhsc.models.ServerConfiguration; + +public final class ServerConfigurationImpl implements ServerConfiguration { + private ServerConfigurationInner innerObject; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + ServerConfigurationImpl( + ServerConfigurationInner innerObject, + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager 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 value() { + return this.innerModel().value(); + } + + public String source() { + return this.innerModel().source(); + } + + 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 ServerConfigurationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerGroupConfigurationImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerGroupConfigurationImpl.java new file mode 100644 index 0000000000000..8c04f451a74df --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerGroupConfigurationImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupConfigurationInner; +import com.azure.resourcemanager.postgresqlhsc.models.ConfigurationDataType; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupConfiguration; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRoleGroupConfiguration; +import java.util.Collections; +import java.util.List; + +public final class ServerGroupConfigurationImpl implements ServerGroupConfiguration { + private ServerGroupConfigurationInner innerObject; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + ServerGroupConfigurationImpl( + ServerGroupConfigurationInner innerObject, + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager 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 description() { + return this.innerModel().description(); + } + + public ConfigurationDataType dataType() { + return this.innerModel().dataType(); + } + + public String allowedValues() { + return this.innerModel().allowedValues(); + } + + public List serverRoleGroupConfigurations() { + List inner = this.innerModel().serverRoleGroupConfigurations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ServerGroupConfigurationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerGroupImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerGroupImpl.java new file mode 100644 index 0000000000000..4098ffc58e2b0 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerGroupImpl.java @@ -0,0 +1,467 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupInner; +import com.azure.resourcemanager.postgresqlhsc.models.CitusVersion; +import com.azure.resourcemanager.postgresqlhsc.models.CreateMode; +import com.azure.resourcemanager.postgresqlhsc.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlhsc.models.PostgreSqlVersion; +import com.azure.resourcemanager.postgresqlhsc.models.ResourceProviderType; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroup; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupForUpdate; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupPropertiesDelegatedSubnetArguments; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupPropertiesPrivateDnsZoneArguments; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRoleGroup; +import com.azure.resourcemanager.postgresqlhsc.models.ServerState; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ServerGroupImpl implements ServerGroup, ServerGroup.Definition, ServerGroup.Update { + private ServerGroupInner innerObject; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public CreateMode createMode() { + return this.innerModel().createMode(); + } + + public String administratorLogin() { + return this.innerModel().administratorLogin(); + } + + public String administratorLoginPassword() { + return this.innerModel().administratorLoginPassword(); + } + + public Integer backupRetentionDays() { + return this.innerModel().backupRetentionDays(); + } + + public PostgreSqlVersion postgresqlVersion() { + return this.innerModel().postgresqlVersion(); + } + + public CitusVersion citusVersion() { + return this.innerModel().citusVersion(); + } + + public Boolean enableMx() { + return this.innerModel().enableMx(); + } + + public Boolean enableZfs() { + return this.innerModel().enableZfs(); + } + + public Boolean enableShardsOnCoordinator() { + return this.innerModel().enableShardsOnCoordinator(); + } + + public ServerState state() { + return this.innerModel().state(); + } + + public OffsetDateTime earliestRestoreTime() { + return this.innerModel().earliestRestoreTime(); + } + + public ResourceProviderType resourceProviderType() { + return this.innerModel().resourceProviderType(); + } + + public List serverRoleGroups() { + List inner = this.innerModel().serverRoleGroups(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MaintenanceWindow maintenanceWindow() { + return this.innerModel().maintenanceWindow(); + } + + public String availabilityZone() { + return this.innerModel().availabilityZone(); + } + + public String standbyAvailabilityZone() { + return this.innerModel().standbyAvailabilityZone(); + } + + public ServerGroupPropertiesDelegatedSubnetArguments delegatedSubnetArguments() { + return this.innerModel().delegatedSubnetArguments(); + } + + public ServerGroupPropertiesPrivateDnsZoneArguments privateDnsZoneArguments() { + return this.innerModel().privateDnsZoneArguments(); + } + + public List readReplicas() { + List inner = this.innerModel().readReplicas(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String sourceServerGroup() { + return this.innerModel().sourceServerGroup(); + } + + public String sourceSubscriptionId() { + return this.innerModel().sourceSubscriptionId(); + } + + public String sourceResourceGroupName() { + return this.innerModel().sourceResourceGroupName(); + } + + public String sourceServerGroupName() { + return this.innerModel().sourceServerGroupName(); + } + + public String sourceLocation() { + return this.innerModel().sourceLocation(); + } + + public OffsetDateTime pointInTimeUtc() { + return this.innerModel().pointInTimeUtc(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ServerGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverGroupName; + + private ServerGroupForUpdate updateParameters; + + public ServerGroupImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ServerGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerGroups() + .createOrUpdate(resourceGroupName, serverGroupName, this.innerModel(), Context.NONE); + return this; + } + + public ServerGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerGroups() + .createOrUpdate(resourceGroupName, serverGroupName, this.innerModel(), context); + return this; + } + + ServerGroupImpl(String name, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerObject = new ServerGroupInner(); + this.serviceManager = serviceManager; + this.serverGroupName = name; + } + + public ServerGroupImpl update() { + this.updateParameters = new ServerGroupForUpdate(); + return this; + } + + public ServerGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerGroups() + .update(resourceGroupName, serverGroupName, updateParameters, Context.NONE); + return this; + } + + public ServerGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerGroups() + .update(resourceGroupName, serverGroupName, updateParameters, context); + return this; + } + + ServerGroupImpl( + ServerGroupInner innerObject, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverGroupName = Utils.getValueFromIdByName(innerObject.id(), "serverGroupsv2"); + } + + public ServerGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerGroups() + .getByResourceGroupWithResponse(resourceGroupName, serverGroupName, Context.NONE) + .getValue(); + return this; + } + + public ServerGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerGroups() + .getByResourceGroupWithResponse(resourceGroupName, serverGroupName, context) + .getValue(); + return this; + } + + public void restart() { + serviceManager.serverGroups().restart(resourceGroupName, serverGroupName); + } + + public void restart(Context context) { + serviceManager.serverGroups().restart(resourceGroupName, serverGroupName, context); + } + + public void start() { + serviceManager.serverGroups().start(resourceGroupName, serverGroupName); + } + + public void start(Context context) { + serviceManager.serverGroups().start(resourceGroupName, serverGroupName, context); + } + + public void stop() { + serviceManager.serverGroups().stop(resourceGroupName, serverGroupName); + } + + public void stop(Context context) { + serviceManager.serverGroups().stop(resourceGroupName, serverGroupName, context); + } + + public ServerGroupImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ServerGroupImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ServerGroupImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ServerGroupImpl withCreateMode(CreateMode createMode) { + this.innerModel().withCreateMode(createMode); + return this; + } + + public ServerGroupImpl withAdministratorLogin(String administratorLogin) { + this.innerModel().withAdministratorLogin(administratorLogin); + return this; + } + + public ServerGroupImpl withAdministratorLoginPassword(String administratorLoginPassword) { + if (isInCreateMode()) { + this.innerModel().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } else { + this.updateParameters.withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + } + + public ServerGroupImpl withBackupRetentionDays(Integer backupRetentionDays) { + if (isInCreateMode()) { + this.innerModel().withBackupRetentionDays(backupRetentionDays); + return this; + } else { + this.updateParameters.withBackupRetentionDays(backupRetentionDays); + return this; + } + } + + public ServerGroupImpl withPostgresqlVersion(PostgreSqlVersion postgresqlVersion) { + if (isInCreateMode()) { + this.innerModel().withPostgresqlVersion(postgresqlVersion); + return this; + } else { + this.updateParameters.withPostgresqlVersion(postgresqlVersion); + return this; + } + } + + public ServerGroupImpl withCitusVersion(CitusVersion citusVersion) { + if (isInCreateMode()) { + this.innerModel().withCitusVersion(citusVersion); + return this; + } else { + this.updateParameters.withCitusVersion(citusVersion); + return this; + } + } + + public ServerGroupImpl withEnableMx(Boolean enableMx) { + this.innerModel().withEnableMx(enableMx); + return this; + } + + public ServerGroupImpl withEnableZfs(Boolean enableZfs) { + this.innerModel().withEnableZfs(enableZfs); + return this; + } + + public ServerGroupImpl withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) { + if (isInCreateMode()) { + this.innerModel().withEnableShardsOnCoordinator(enableShardsOnCoordinator); + return this; + } else { + this.updateParameters.withEnableShardsOnCoordinator(enableShardsOnCoordinator); + return this; + } + } + + public ServerGroupImpl withServerRoleGroups(List serverRoleGroups) { + if (isInCreateMode()) { + this.innerModel().withServerRoleGroups(serverRoleGroups); + return this; + } else { + this.updateParameters.withServerRoleGroups(serverRoleGroups); + return this; + } + } + + public ServerGroupImpl withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + if (isInCreateMode()) { + this.innerModel().withMaintenanceWindow(maintenanceWindow); + return this; + } else { + this.updateParameters.withMaintenanceWindow(maintenanceWindow); + return this; + } + } + + public ServerGroupImpl withAvailabilityZone(String availabilityZone) { + if (isInCreateMode()) { + this.innerModel().withAvailabilityZone(availabilityZone); + return this; + } else { + this.updateParameters.withAvailabilityZone(availabilityZone); + return this; + } + } + + public ServerGroupImpl withStandbyAvailabilityZone(String standbyAvailabilityZone) { + if (isInCreateMode()) { + this.innerModel().withStandbyAvailabilityZone(standbyAvailabilityZone); + return this; + } else { + this.updateParameters.withStandbyAvailabilityZone(standbyAvailabilityZone); + return this; + } + } + + public ServerGroupImpl withDelegatedSubnetArguments( + ServerGroupPropertiesDelegatedSubnetArguments delegatedSubnetArguments) { + this.innerModel().withDelegatedSubnetArguments(delegatedSubnetArguments); + return this; + } + + public ServerGroupImpl withPrivateDnsZoneArguments( + ServerGroupPropertiesPrivateDnsZoneArguments privateDnsZoneArguments) { + this.innerModel().withPrivateDnsZoneArguments(privateDnsZoneArguments); + return this; + } + + public ServerGroupImpl withSourceSubscriptionId(String sourceSubscriptionId) { + this.innerModel().withSourceSubscriptionId(sourceSubscriptionId); + return this; + } + + public ServerGroupImpl withSourceResourceGroupName(String sourceResourceGroupName) { + this.innerModel().withSourceResourceGroupName(sourceResourceGroupName); + return this; + } + + public ServerGroupImpl withSourceServerGroupName(String sourceServerGroupName) { + this.innerModel().withSourceServerGroupName(sourceServerGroupName); + return this; + } + + public ServerGroupImpl withSourceLocation(String sourceLocation) { + this.innerModel().withSourceLocation(sourceLocation); + return this; + } + + public ServerGroupImpl withPointInTimeUtc(OffsetDateTime pointInTimeUtc) { + this.innerModel().withPointInTimeUtc(pointInTimeUtc); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerGroupServerImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerGroupServerImpl.java new file mode 100644 index 0000000000000..57b7df48967c0 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerGroupServerImpl.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupServerInner; +import com.azure.resourcemanager.postgresqlhsc.models.CitusVersion; +import com.azure.resourcemanager.postgresqlhsc.models.PostgreSqlVersion; +import com.azure.resourcemanager.postgresqlhsc.models.ServerEdition; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupServer; +import com.azure.resourcemanager.postgresqlhsc.models.ServerHaState; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRole; +import com.azure.resourcemanager.postgresqlhsc.models.ServerState; + +public final class ServerGroupServerImpl implements ServerGroupServer { + private ServerGroupServerInner innerObject; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + ServerGroupServerImpl( + ServerGroupServerInner innerObject, + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager 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 fullyQualifiedDomainName() { + return this.innerModel().fullyQualifiedDomainName(); + } + + public ServerRole role() { + return this.innerModel().role(); + } + + public ServerState state() { + return this.innerModel().state(); + } + + public ServerHaState haState() { + return this.innerModel().haState(); + } + + public String administratorLogin() { + return this.innerModel().administratorLogin(); + } + + public PostgreSqlVersion postgresqlVersion() { + return this.innerModel().postgresqlVersion(); + } + + public CitusVersion citusVersion() { + return this.innerModel().citusVersion(); + } + + public String availabilityZone() { + return this.innerModel().availabilityZone(); + } + + public String standbyAvailabilityZone() { + return this.innerModel().standbyAvailabilityZone(); + } + + public ServerEdition serverEdition() { + return this.innerModel().serverEdition(); + } + + public Long storageQuotaInMb() { + return this.innerModel().storageQuotaInMb(); + } + + public Long vCores() { + return this.innerModel().vCores(); + } + + public Boolean enableHa() { + return this.innerModel().enableHa(); + } + + public Boolean enablePublicIp() { + return this.innerModel().enablePublicIp(); + } + + public ServerGroupServerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerGroupsClientImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerGroupsClientImpl.java new file mode 100644 index 0000000000000..dce1e5006e8e3 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerGroupsClientImpl.java @@ -0,0 +1,2448 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.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.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlhsc.fluent.ServerGroupsClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupInner; +import com.azure.resourcemanager.postgresqlhsc.models.NameAvailabilityRequest; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupForUpdate; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupListResult; +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 ServerGroupsClient. */ +public final class ServerGroupsClientImpl implements ServerGroupsClient { + private final ClientLogger logger = new ClientLogger(ServerGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerGroupsService service; + + /** The service client containing this operation class. */ + private final MicrosoftPostgreSqlHyperscaleImpl client; + + /** + * Initializes an instance of ServerGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerGroupsClientImpl(MicrosoftPostgreSqlHyperscaleImpl client) { + this.service = + RestProxy.create(ServerGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftPostgreSqlHyperscaleServerGroups to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftPostgreSqlH") + private interface ServerGroupsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSql/serverGroupsv2") + @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"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2") + @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"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}") + @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("serverGroupName") String serverGroupName, + @BodyParam("application/json") ServerGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}") + @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("serverGroupName") String serverGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}") + @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("serverGroupName") String serverGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}") + @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("serverGroupName") String serverGroupName, + @BodyParam("application/json") ServerGroupForUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}/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("serverGroupName") String serverGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}/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("serverGroupName") String serverGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}/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("serverGroupName") String serverGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSql/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") NameAvailabilityRequest nameAvailabilityRequest, + @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); + + @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); + } + + /** + * List all the server groups 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 server groups. + */ + @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 server groups 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 server groups. + */ + @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 server groups 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 server groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all the server groups 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 server groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the server groups 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 server groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all the server groups 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 server groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List all the server groups 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 server groups. + */ + @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 server groups 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 server groups. + */ + @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 server groups 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 server groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List all the server groups 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 server groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the server groups 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 server groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List all the server groups 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 server groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Creates a new server group with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The required parameters for creating or updating a server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverGroupName, ServerGroupInner 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new server group with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The required parameters for creating or updating a server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverGroupName, ServerGroupInner 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + parameters, + accept, + context); + } + + /** + * Creates a new server group with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The required parameters for creating or updating a server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverGroupName, ServerGroupInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerGroupInner.class, + ServerGroupInner.class, + this.client.getContext()); + } + + /** + * Creates a new server group with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The required parameters for creating or updating a server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverGroupName, ServerGroupInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverGroupName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerGroupInner.class, ServerGroupInner.class, context); + } + + /** + * Creates a new server group with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The required parameters for creating or updating a server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerGroupInner> beginCreateOrUpdate( + String resourceGroupName, String serverGroupName, ServerGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverGroupName, parameters).getSyncPoller(); + } + + /** + * Creates a new server group with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The required parameters for creating or updating a server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerGroupInner> beginCreateOrUpdate( + String resourceGroupName, String serverGroupName, ServerGroupInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverGroupName, parameters, context).getSyncPoller(); + } + + /** + * Creates a new server group with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The required parameters for creating or updating a server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverGroupName, ServerGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new server group with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The required parameters for creating or updating a server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverGroupName, ServerGroupInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new server group with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The required parameters for creating or updating a server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerGroupInner createOrUpdate( + String resourceGroupName, String serverGroupName, ServerGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverGroupName, parameters).block(); + } + + /** + * Creates a new server group with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The required parameters for creating or updating a server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerGroupInner createOrUpdate( + String resourceGroupName, String serverGroupName, ServerGroupInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, serverGroupName, parameters, context).block(); + } + + /** + * Gets information about a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String serverGroupName) { + 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + accept, + context); + } + + /** + * Gets information about a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String serverGroupName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, serverGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerGroupInner getByResourceGroup(String resourceGroupName, String serverGroupName) { + return getByResourceGroupAsync(resourceGroupName, serverGroupName).block(); + } + + /** + * Gets information about a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String serverGroupName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, serverGroupName, context).block(); + } + + /** + * Deletes a server group together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String serverGroupName) { + 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a server group together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + accept, + context); + } + + /** + * Deletes a server group together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverGroupName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a server group together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a server group together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String serverGroupName) { + return beginDeleteAsync(resourceGroupName, serverGroupName).getSyncPoller(); + } + + /** + * Deletes a server group together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, serverGroupName, context).getSyncPoller(); + } + + /** + * Deletes a server group together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverGroupName) { + return beginDeleteAsync(resourceGroupName, serverGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server group together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, serverGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server group together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverGroupName) { + deleteAsync(resourceGroupName, serverGroupName).block(); + } + + /** + * Deletes a server group together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverGroupName, Context context) { + deleteAsync(resourceGroupName, serverGroupName, context).block(); + } + + /** + * Updates an existing server group. The request body can contain one to many of the properties present in the + * normal server group definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The parameters for updating a server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverGroupName, ServerGroupForUpdate 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing server group. The request body can contain one to many of the properties present in the + * normal server group definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The parameters for updating a server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverGroupName, ServerGroupForUpdate 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + parameters, + accept, + context); + } + + /** + * Updates an existing server group. The request body can contain one to many of the properties present in the + * normal server group definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The parameters for updating a server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerGroupInner> beginUpdateAsync( + String resourceGroupName, String serverGroupName, ServerGroupForUpdate parameters) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, serverGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerGroupInner.class, + ServerGroupInner.class, + this.client.getContext()); + } + + /** + * Updates an existing server group. The request body can contain one to many of the properties present in the + * normal server group definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The parameters for updating a server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerGroupInner> beginUpdateAsync( + String resourceGroupName, String serverGroupName, ServerGroupForUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverGroupName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerGroupInner.class, ServerGroupInner.class, context); + } + + /** + * Updates an existing server group. The request body can contain one to many of the properties present in the + * normal server group definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The parameters for updating a server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerGroupInner> beginUpdate( + String resourceGroupName, String serverGroupName, ServerGroupForUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverGroupName, parameters).getSyncPoller(); + } + + /** + * Updates an existing server group. The request body can contain one to many of the properties present in the + * normal server group definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The parameters for updating a server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerGroupInner> beginUpdate( + String resourceGroupName, String serverGroupName, ServerGroupForUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, serverGroupName, parameters, context).getSyncPoller(); + } + + /** + * Updates an existing server group. The request body can contain one to many of the properties present in the + * normal server group definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The parameters for updating a server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverGroupName, ServerGroupForUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing server group. The request body can contain one to many of the properties present in the + * normal server group definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The parameters for updating a server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverGroupName, ServerGroupForUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, serverGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing server group. The request body can contain one to many of the properties present in the + * normal server group definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The parameters for updating a server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerGroupInner update(String resourceGroupName, String serverGroupName, ServerGroupForUpdate parameters) { + return updateAsync(resourceGroupName, serverGroupName, parameters).block(); + } + + /** + * Updates an existing server group. The request body can contain one to many of the properties present in the + * normal server group definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param parameters The parameters for updating a server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 group for create. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerGroupInner update( + String resourceGroupName, String serverGroupName, ServerGroupForUpdate parameters, Context context) { + return updateAsync(resourceGroupName, serverGroupName, parameters, context).block(); + } + + /** + * Restarts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> restartWithResponseAsync( + String resourceGroupName, String serverGroupName) { + 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .restart( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Restarts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> restartWithResponseAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .restart( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverGroupName, + accept, + context); + } + + /** + * Restarts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync(String resourceGroupName, String serverGroupName) { + Mono>> mono = restartWithResponseAsync(resourceGroupName, serverGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Restarts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String serverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = restartWithResponseAsync(resourceGroupName, serverGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Restarts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart(String resourceGroupName, String serverGroupName) { + return beginRestartAsync(resourceGroupName, serverGroupName).getSyncPoller(); + } + + /** + * Restarts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String serverGroupName, Context context) { + return beginRestartAsync(resourceGroupName, serverGroupName, context).getSyncPoller(); + } + + /** + * Restarts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restartAsync(String resourceGroupName, String serverGroupName) { + return beginRestartAsync(resourceGroupName, serverGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restarts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restartAsync(String resourceGroupName, String serverGroupName, Context context) { + return beginRestartAsync(resourceGroupName, serverGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restarts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverGroupName) { + restartAsync(resourceGroupName, serverGroupName).block(); + } + + /** + * Restarts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverGroupName, Context context) { + restartAsync(resourceGroupName, serverGroupName, context).block(); + } + + /** + * Starts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync(String resourceGroupName, String serverGroupName) { + 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Starts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + accept, + context); + } + + /** + * Starts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync(String resourceGroupName, String serverGroupName) { + Mono>> mono = startWithResponseAsync(resourceGroupName, serverGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Starts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String serverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = startWithResponseAsync(resourceGroupName, serverGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Starts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart(String resourceGroupName, String serverGroupName) { + return beginStartAsync(resourceGroupName, serverGroupName).getSyncPoller(); + } + + /** + * Starts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart( + String resourceGroupName, String serverGroupName, Context context) { + return beginStartAsync(resourceGroupName, serverGroupName, context).getSyncPoller(); + } + + /** + * Starts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String serverGroupName) { + return beginStartAsync(resourceGroupName, serverGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String serverGroupName, Context context) { + return beginStartAsync(resourceGroupName, serverGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverGroupName) { + startAsync(resourceGroupName, serverGroupName).block(); + } + + /** + * Starts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverGroupName, Context context) { + startAsync(resourceGroupName, serverGroupName, context).block(); + } + + /** + * Stops the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> stopWithResponseAsync(String resourceGroupName, String serverGroupName) { + 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Stops the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> stopWithResponseAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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, + serverGroupName, + accept, + context); + } + + /** + * Stops the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStopAsync(String resourceGroupName, String serverGroupName) { + Mono>> mono = stopWithResponseAsync(resourceGroupName, serverGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Stops the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStopAsync( + String resourceGroupName, String serverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = stopWithResponseAsync(resourceGroupName, serverGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Stops the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStop(String resourceGroupName, String serverGroupName) { + return beginStopAsync(resourceGroupName, serverGroupName).getSyncPoller(); + } + + /** + * Stops the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStop( + String resourceGroupName, String serverGroupName, Context context) { + return beginStopAsync(resourceGroupName, serverGroupName, context).getSyncPoller(); + } + + /** + * Stops the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync(String resourceGroupName, String serverGroupName) { + return beginStopAsync(resourceGroupName, serverGroupName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Stops the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync(String resourceGroupName, String serverGroupName, Context context) { + return beginStopAsync(resourceGroupName, serverGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Stops the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverGroupName) { + stopAsync(resourceGroupName, serverGroupName).block(); + } + + /** + * Stops the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverGroupName, Context context) { + stopAsync(resourceGroupName, serverGroupName, 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) + private Mono> checkNameAvailabilityWithResponseAsync( + NameAvailabilityRequest 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 + .checkNameAvailability( + 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + NameAvailabilityRequest 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 + .checkNameAvailability( + 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync(NameAvailabilityRequest nameAvailabilityRequest) { + return checkNameAvailabilityWithResponseAsync(nameAvailabilityRequest) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 checkNameAvailability(NameAvailabilityRequest nameAvailabilityRequest) { + return checkNameAvailabilityAsync(nameAvailabilityRequest).block(); + } + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + NameAvailabilityRequest nameAvailabilityRequest, Context context) { + return checkNameAvailabilityWithResponseAsync(nameAvailabilityRequest, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server groups. + */ + @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)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server groups. + */ + @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)); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerGroupsImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerGroupsImpl.java new file mode 100644 index 0000000000000..8af974b7d3473 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerGroupsImpl.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.postgresqlhsc.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.postgresqlhsc.fluent.ServerGroupsClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupInner; +import com.azure.resourcemanager.postgresqlhsc.models.NameAvailability; +import com.azure.resourcemanager.postgresqlhsc.models.NameAvailabilityRequest; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroup; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroups; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerGroupsImpl implements ServerGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerGroupsImpl.class); + + private final ServerGroupsClient innerClient; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + public ServerGroupsImpl( + ServerGroupsClient innerClient, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ServerGroupImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ServerGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ServerGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ServerGroupImpl(inner1, this.manager())); + } + + public ServerGroup getByResourceGroup(String resourceGroupName, String serverGroupName) { + ServerGroupInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, serverGroupName); + if (inner != null) { + return new ServerGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String serverGroupName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, serverGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String serverGroupName) { + this.serviceClient().delete(resourceGroupName, serverGroupName); + } + + public void delete(String resourceGroupName, String serverGroupName, Context context) { + this.serviceClient().delete(resourceGroupName, serverGroupName, context); + } + + public void restart(String resourceGroupName, String serverGroupName) { + this.serviceClient().restart(resourceGroupName, serverGroupName); + } + + public void restart(String resourceGroupName, String serverGroupName, Context context) { + this.serviceClient().restart(resourceGroupName, serverGroupName, context); + } + + public void start(String resourceGroupName, String serverGroupName) { + this.serviceClient().start(resourceGroupName, serverGroupName); + } + + public void start(String resourceGroupName, String serverGroupName, Context context) { + this.serviceClient().start(resourceGroupName, serverGroupName, context); + } + + public void stop(String resourceGroupName, String serverGroupName) { + this.serviceClient().stop(resourceGroupName, serverGroupName); + } + + public void stop(String resourceGroupName, String serverGroupName, Context context) { + this.serviceClient().stop(resourceGroupName, serverGroupName, context); + } + + public NameAvailability checkNameAvailability(NameAvailabilityRequest nameAvailabilityRequest) { + NameAvailabilityInner inner = this.serviceClient().checkNameAvailability(nameAvailabilityRequest); + if (inner != null) { + return new NameAvailabilityImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkNameAvailabilityWithResponse( + NameAvailabilityRequest nameAvailabilityRequest, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityWithResponse(nameAvailabilityRequest, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NameAvailabilityImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerGroup 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 serverGroupName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (serverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, serverGroupName, 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 serverGroupName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (serverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, serverGroupName, 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 serverGroupName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (serverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", id))); + } + this.delete(resourceGroupName, serverGroupName, 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 serverGroupName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (serverGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", id))); + } + this.delete(resourceGroupName, serverGroupName, context); + } + + private ServerGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } + + public ServerGroupImpl define(String name) { + return new ServerGroupImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServersClientImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServersClientImpl.java new file mode 100644 index 0000000000000..262928c05a92f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServersClientImpl.java @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.fluent.ServersClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupServerInner; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupServerListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServersClient. */ +public final class ServersClientImpl implements ServersClient { + private final ClientLogger logger = new ClientLogger(ServersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServersService service; + + /** The service client containing this operation class. */ + private final MicrosoftPostgreSqlHyperscaleImpl client; + + /** + * Initializes an instance of ServersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServersClientImpl(MicrosoftPostgreSqlHyperscaleImpl client) { + this.service = RestProxy.create(ServersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftPostgreSqlHyperscaleServers to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftPostgreSqlH") + private interface ServersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}/servers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverGroupName") String serverGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" + + "/serverGroupsv2/{serverGroupName}/servers/{serverName}") + @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("serverGroupName") String serverGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists servers of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 in a server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerGroupSinglePageAsync( + String resourceGroupName, String serverGroupName) { + 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServerGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverGroupName, + 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())); + } + + /** + * Lists servers of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 in a server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerGroupSinglePageAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists servers of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 in a server group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerGroupAsync(String resourceGroupName, String serverGroupName) { + return new PagedFlux<>(() -> listByServerGroupSinglePageAsync(resourceGroupName, serverGroupName)); + } + + /** + * Lists servers of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 in a server group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerGroupAsync( + String resourceGroupName, String serverGroupName, Context context) { + return new PagedFlux<>(() -> listByServerGroupSinglePageAsync(resourceGroupName, serverGroupName, context)); + } + + /** + * Lists servers of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 in a server group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName) { + return new PagedIterable<>(listByServerGroupAsync(resourceGroupName, serverGroupName)); + } + + /** + * Lists servers of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 in a server group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServerGroup( + String resourceGroupName, String serverGroupName, Context context) { + return new PagedIterable<>(listByServerGroupAsync(resourceGroupName, serverGroupName, context)); + } + + /** + * Gets information about a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @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 in server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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 + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverGroupName, + serverName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @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 in server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverGroupName, 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 (serverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverGroupName 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 + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverGroupName, + serverName, + accept, + context); + } + + /** + * Gets information about a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @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 in server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverGroupName, String serverName) { + return getWithResponseAsync(resourceGroupName, serverGroupName, serverName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @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 in server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerGroupServerInner get(String resourceGroupName, String serverGroupName, String serverName) { + return getAsync(resourceGroupName, serverGroupName, serverName).block(); + } + + /** + * Gets information about a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @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 in server group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverGroupName, String serverName, Context context) { + return getWithResponseAsync(resourceGroupName, serverGroupName, serverName, context).block(); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServersImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServersImpl.java new file mode 100644 index 0000000000000..8472f56446eba --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServersImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.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.postgresqlhsc.fluent.ServersClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupServerInner; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupServer; +import com.azure.resourcemanager.postgresqlhsc.models.Servers; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServersImpl implements Servers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServersImpl.class); + + private final ServersClient innerClient; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + public ServersImpl( + ServersClient innerClient, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName) { + PagedIterable inner = + this.serviceClient().listByServerGroup(resourceGroupName, serverGroupName); + return Utils.mapPage(inner, inner1 -> new ServerGroupServerImpl(inner1, this.manager())); + } + + public PagedIterable listByServerGroup( + String resourceGroupName, String serverGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByServerGroup(resourceGroupName, serverGroupName, context); + return Utils.mapPage(inner, inner1 -> new ServerGroupServerImpl(inner1, this.manager())); + } + + public ServerGroupServer get(String resourceGroupName, String serverGroupName, String serverName) { + ServerGroupServerInner inner = this.serviceClient().get(resourceGroupName, serverGroupName, serverName); + if (inner != null) { + return new ServerGroupServerImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverGroupName, serverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerGroupServerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ServersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/Utils.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/Utils.java new file mode 100644 index 0000000000000..98f804e4abf80 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/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.postgresqlhsc.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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/package-info.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/package-info.java new file mode 100644 index 0000000000000..9ae89ec2255bd --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/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 MicrosoftPostgreSqlHyperscale. The Microsoft Azure management API provides + * create, read, update, and delete functionality for Azure PostgreSQL Hyperscale (Citus) resources including server + * groups, servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations. + */ +package com.azure.resourcemanager.postgresqlhsc.implementation; diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/CitusVersion.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/CitusVersion.java new file mode 100644 index 0000000000000..da321cd63d3af --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/CitusVersion.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.postgresqlhsc.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CitusVersion. */ +public final class CitusVersion extends ExpandableStringEnum { + /** Static value 8.3 for CitusVersion. */ + public static final CitusVersion EIGHT_THREE = fromString("8.3"); + + /** Static value 9.0 for CitusVersion. */ + public static final CitusVersion NINE_ZERO = fromString("9.0"); + + /** Static value 9.1 for CitusVersion. */ + public static final CitusVersion NINE_ONE = fromString("9.1"); + + /** Static value 9.2 for CitusVersion. */ + public static final CitusVersion NINE_TWO = fromString("9.2"); + + /** Static value 9.3 for CitusVersion. */ + public static final CitusVersion NINE_THREE = fromString("9.3"); + + /** Static value 9.4 for CitusVersion. */ + public static final CitusVersion NINE_FOUR = fromString("9.4"); + + /** Static value 9.5 for CitusVersion. */ + public static final CitusVersion NINE_FIVE = fromString("9.5"); + + /** + * Creates or finds a CitusVersion from its string representation. + * + * @param name a name to look for. + * @return the corresponding CitusVersion. + */ + @JsonCreator + public static CitusVersion fromString(String name) { + return fromString(name, CitusVersion.class); + } + + /** @return known CitusVersion values. */ + public static Collection values() { + return values(CitusVersion.class); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ConfigurationDataType.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ConfigurationDataType.java new file mode 100644 index 0000000000000..14ac0d4bb456c --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ConfigurationDataType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ConfigurationDataType. */ +public final class ConfigurationDataType extends ExpandableStringEnum { + /** Static value Boolean for ConfigurationDataType. */ + public static final ConfigurationDataType BOOLEAN = fromString("Boolean"); + + /** Static value Numeric for ConfigurationDataType. */ + public static final ConfigurationDataType NUMERIC = fromString("Numeric"); + + /** Static value Integer for ConfigurationDataType. */ + public static final ConfigurationDataType INTEGER = fromString("Integer"); + + /** Static value Enumeration for ConfigurationDataType. */ + public static final ConfigurationDataType ENUMERATION = fromString("Enumeration"); + + /** + * Creates or finds a ConfigurationDataType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConfigurationDataType. + */ + @JsonCreator + public static ConfigurationDataType fromString(String name) { + return fromString(name, ConfigurationDataType.class); + } + + /** @return known ConfigurationDataType values. */ + public static Collection values() { + return values(ConfigurationDataType.class); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Configurations.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Configurations.java new file mode 100644 index 0000000000000..63745116a8d63 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Configurations.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupConfigurationInner; + +/** Resource collection API of Configurations. */ +public interface Configurations { + /** + * List all the configurations of a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @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. + */ + PagedIterable listByServer( + String resourceGroupName, String serverGroupName, String serverName); + + /** + * List all the configurations of a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @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. + */ + PagedIterable listByServer( + String resourceGroupName, String serverGroupName, String serverName, Context context); + + /** + * List all the configurations of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 group configurations. + */ + PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName); + + /** + * List all the configurations of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 group configurations. + */ + PagedIterable listByServerGroup( + String resourceGroupName, String serverGroupName, Context context); + + /** + * Updates configuration of server role groups in a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group configuration. + * @param parameters The required parameters for updating a server group 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 the configuration list of server role groups in a server group. + */ + ServerGroupConfiguration update( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner parameters); + + /** + * Updates configuration of server role groups in a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group configuration. + * @param parameters The required parameters for updating a server group 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 the configuration list of server role groups in a server group. + */ + ServerGroupConfiguration update( + String resourceGroupName, + String serverGroupName, + String configurationName, + ServerGroupConfigurationInner parameters, + Context context); + + /** + * Gets information about single server group configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group 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 single server group configuration. + */ + ServerGroupConfiguration get(String resourceGroupName, String serverGroupName, String configurationName); + + /** + * Gets information about single server group configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param configurationName The name of the server group 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 single server group configuration. + */ + Response getWithResponse( + String resourceGroupName, String serverGroupName, String configurationName, Context context); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/CreateMode.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/CreateMode.java new file mode 100644 index 0000000000000..c8bf898be3049 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/CreateMode.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.postgresqlhsc.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CreateMode. */ +public final class CreateMode extends ExpandableStringEnum { + /** Static value Default for CreateMode. */ + public static final CreateMode DEFAULT = fromString("Default"); + + /** Static value PointInTimeRestore for CreateMode. */ + public static final CreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** Static value ReadReplica for CreateMode. */ + public static final CreateMode READ_REPLICA = fromString("ReadReplica"); + + /** + * 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); + } + + /** @return known CreateMode values. */ + public static Collection values() { + return values(CreateMode.class); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/FirewallRule.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/FirewallRule.java new file mode 100644 index 0000000000000..4f1e904a61d6d --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/FirewallRule.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.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: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the startIpAddress property: The start IP address of the server group firewall rule. Must be IPv4 format. + * + * @return the startIpAddress value. + */ + String startIpAddress(); + + /** + * Gets the endIpAddress property: The end IP address of the server group firewall rule. Must be IPv4 format. + * + * @return the endIpAddress value. + */ + String endIpAddress(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlhsc.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, serverGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @return the next definition stage. + */ + WithStartIpAddress withExistingServerGroupsv2(String resourceGroupName, String serverGroupName); + } + /** The stage of the FirewallRule definition allowing to specify startIpAddress. */ + interface WithStartIpAddress { + /** + * Specifies the startIpAddress property: The start IP address of the server group firewall rule. Must be + * IPv4 format.. + * + * @param startIpAddress The start IP address of the server group 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 group firewall rule. Must be IPv4 + * format.. + * + * @param endIpAddress The end IP address of the server group 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 group firewall rule. Must be + * IPv4 format.. + * + * @param startIpAddress The start IP address of the server group 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 group firewall rule. Must be IPv4 + * format.. + * + * @param endIpAddress The end IP address of the server group 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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/FirewallRuleListResult.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/FirewallRuleListResult.java new file mode 100644 index 0000000000000..ded0585da2c56 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/FirewallRuleListResult.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.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.FirewallRuleInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of firewall rules. */ +@Fluent +public final class FirewallRuleListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FirewallRuleListResult.class); + + /* + * The list of firewall rules in a server group. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of firewall rules in a server group. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of firewall rules in a server group. + * + * @param value the value value to set. + * @return the FirewallRuleListResult object itself. + */ + public FirewallRuleListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/FirewallRules.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/FirewallRules.java new file mode 100644 index 0000000000000..ab3eaedcef687 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/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.postgresqlhsc.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 server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 serverGroupName, String firewallRuleName); + + /** + * Deletes a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 serverGroupName, String firewallRuleName, Context context); + + /** + * Gets information about a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 information about a server group firewall rule. + */ + FirewallRule get(String resourceGroupName, String serverGroupName, String firewallRuleName); + + /** + * Gets information about a server group firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param firewallRuleName The name of the server group 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 information about a server group firewall rule. + */ + Response getWithResponse( + String resourceGroupName, String serverGroupName, String firewallRuleName, Context context); + + /** + * List all the firewall rules in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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. + */ + PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName); + + /** + * List all the firewall rules in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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. + */ + PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName, Context context); + + /** + * Gets information about a server group firewall rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a server group firewall rule. + */ + FirewallRule getById(String id); + + /** + * Gets information about a server group firewall rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a server group firewall rule. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a server group 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 server group 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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/MaintenanceWindow.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/MaintenanceWindow.java new file mode 100644 index 0000000000000..15857ad6996b6 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/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.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Maintenance window of a server group. */ +@Fluent +public final class MaintenanceWindow { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MaintenanceWindow.class); + + /* + * indicates whether custom window is enabled or disabled + */ + @JsonProperty(value = "customWindow") + private String customWindow; + + /* + * start hour for maintenance window + */ + @JsonProperty(value = "startHour") + private Integer startHour; + + /* + * start minute for maintenance window + */ + @JsonProperty(value = "startMinute") + private Integer startMinute; + + /* + * day of week for maintenance window + */ + @JsonProperty(value = "dayOfWeek") + private Integer dayOfWeek; + + /** + * Get the customWindow property: indicates whether custom window is enabled or disabled. + * + * @return the customWindow value. + */ + public String customWindow() { + return this.customWindow; + } + + /** + * Set the customWindow property: indicates whether custom window is enabled or disabled. + * + * @param customWindow the customWindow value to set. + * @return the MaintenanceWindow object itself. + */ + public MaintenanceWindow withCustomWindow(String customWindow) { + this.customWindow = customWindow; + return this; + } + + /** + * Get the startHour property: start hour for maintenance window. + * + * @return the startHour value. + */ + public Integer startHour() { + return this.startHour; + } + + /** + * Set the startHour property: start hour for maintenance window. + * + * @param startHour the startHour value to set. + * @return the MaintenanceWindow object itself. + */ + public MaintenanceWindow withStartHour(Integer startHour) { + this.startHour = startHour; + return this; + } + + /** + * Get the startMinute property: start minute for maintenance window. + * + * @return the startMinute value. + */ + public Integer startMinute() { + return this.startMinute; + } + + /** + * Set the startMinute property: start minute for maintenance window. + * + * @param startMinute the startMinute value to set. + * @return the MaintenanceWindow object itself. + */ + public MaintenanceWindow withStartMinute(Integer startMinute) { + this.startMinute = startMinute; + return this; + } + + /** + * Get the dayOfWeek property: day of week for maintenance window. + * + * @return the dayOfWeek value. + */ + public Integer dayOfWeek() { + return this.dayOfWeek; + } + + /** + * Set the dayOfWeek property: day of week for maintenance window. + * + * @param dayOfWeek the dayOfWeek value to set. + * @return the MaintenanceWindow object itself. + */ + public MaintenanceWindow withDayOfWeek(Integer dayOfWeek) { + this.dayOfWeek = dayOfWeek; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/NameAvailability.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/NameAvailability.java new file mode 100644 index 0000000000000..f487b73957a55 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/NameAvailability.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.postgresqlhsc.models; + +import com.azure.resourcemanager.postgresqlhsc.fluent.models.NameAvailabilityInner; + +/** An immutable client-side representation of NameAvailability. */ +public interface NameAvailability { + /** + * Gets the message property: Error Message. + * + * @return the message value. + */ + String message(); + + /** + * Gets the nameAvailable property: Indicates whether the resource name is available. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * 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.postgresqlhsc.fluent.models.NameAvailabilityInner object. + * + * @return the inner object. + */ + NameAvailabilityInner innerModel(); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/NameAvailabilityRequest.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/NameAvailabilityRequest.java new file mode 100644 index 0000000000000..e1e8c2a8a8a92 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/NameAvailabilityRequest.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Request from client to check resource name availability. */ +@Fluent +public final class NameAvailabilityRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NameAvailabilityRequest.class); + + /* + * Resource name to verify. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Resource type used for verification. + */ + @JsonProperty(value = "type", required = true) + private String type = "Microsoft.DBforPostgreSQL/serverGroupsv2"; + + /** Creates an instance of NameAvailabilityRequest class. */ + public NameAvailabilityRequest() { + type = "Microsoft.DBforPostgreSQL/serverGroupsv2"; + } + + /** + * Get the name property: Resource name to verify. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Resource name to verify. + * + * @param name the name value to set. + * @return the NameAvailabilityRequest object itself. + */ + public NameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Resource type used for verification. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Resource type used for verification. + * + * @param type the type value to set. + * @return the NameAvailabilityRequest object itself. + */ + public NameAvailabilityRequest withType(String type) { + this.type = type; + 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 NameAvailabilityRequest")); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Operation.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Operation.java new file mode 100644 index 0000000000000..a7670d161d38b --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Operation.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.postgresqlhsc.models; + +import com.azure.resourcemanager.postgresqlhsc.fluent.models.OperationInner; +import java.util.Map; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: The name of the operation being performed on this particular object. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The localized display information for this particular operation or action. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the origin property: The intended executor of the operation. + * + * @return the origin value. + */ + OperationOrigin origin(); + + /** + * Gets the properties property: Additional descriptions for the operation. + * + * @return the properties value. + */ + Map properties(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlhsc.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/OperationDisplay.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/OperationDisplay.java new file mode 100644 index 0000000000000..4ddc7c85322ec --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/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.postgresqlhsc.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Display metadata associated with the operation. */ +@Immutable +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Operation resource provider name. + */ + @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; + + /** + * 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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/OperationListResult.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/OperationListResult.java new file mode 100644 index 0000000000000..476d27fd494ef --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/OperationListResult.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of resource provider operations. */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * 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", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * 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 OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL client should use to fetch the next page (per server side paging). It's null for + * now, added for future use. + * + * @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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/OperationOrigin.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/OperationOrigin.java new file mode 100644 index 0000000000000..1a6b871f0d5e9 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/OperationOrigin.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.postgresqlhsc.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OperationOrigin. */ +public final class OperationOrigin extends ExpandableStringEnum { + /** Static value NotSpecified for OperationOrigin. */ + public static final OperationOrigin NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value user for OperationOrigin. */ + public static final OperationOrigin USER = fromString("user"); + + /** Static value system for OperationOrigin. */ + public static final OperationOrigin SYSTEM = fromString("system"); + + /** + * Creates or finds a OperationOrigin from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationOrigin. + */ + @JsonCreator + public static OperationOrigin fromString(String name) { + return fromString(name, OperationOrigin.class); + } + + /** @return known OperationOrigin values. */ + public static Collection values() { + return values(OperationOrigin.class); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Operations.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Operations.java new file mode 100644 index 0000000000000..98e0ee41d6102 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/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.postgresqlhsc.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * 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. + */ + PagedIterable list(); + + /** + * 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. + */ + PagedIterable list(Context context); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PostgreSqlVersion.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PostgreSqlVersion.java new file mode 100644 index 0000000000000..cbb04b737f1ed --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PostgreSqlVersion.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PostgreSqlVersion. */ +public final class PostgreSqlVersion extends ExpandableStringEnum { + /** Static value 11 for PostgreSqlVersion. */ + public static final PostgreSqlVersion ONE_ONE = fromString("11"); + + /** Static value 12 for PostgreSqlVersion. */ + public static final PostgreSqlVersion ONE_TWO = fromString("12"); + + /** + * Creates or finds a PostgreSqlVersion from its string representation. + * + * @param name a name to look for. + * @return the corresponding PostgreSqlVersion. + */ + @JsonCreator + public static PostgreSqlVersion fromString(String name) { + return fromString(name, PostgreSqlVersion.class); + } + + /** @return known PostgreSqlVersion values. */ + public static Collection values() { + return values(PostgreSqlVersion.class); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ResourceProviderType.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ResourceProviderType.java new file mode 100644 index 0000000000000..551e75c8d3147 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ResourceProviderType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ResourceProviderType. */ +public final class ResourceProviderType extends ExpandableStringEnum { + /** Static value Meru for ResourceProviderType. */ + public static final ResourceProviderType MERU = fromString("Meru"); + + /** Static value Marlin for ResourceProviderType. */ + public static final ResourceProviderType MARLIN = fromString("Marlin"); + + /** + * Creates or finds a ResourceProviderType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceProviderType. + */ + @JsonCreator + public static ResourceProviderType fromString(String name) { + return fromString(name, ResourceProviderType.class); + } + + /** @return known ResourceProviderType values. */ + public static Collection values() { + return values(ResourceProviderType.class); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Role.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Role.java new file mode 100644 index 0000000000000..84e7f3bbd6cb4 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Role.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.RoleInner; + +/** An immutable client-side representation of Role. */ +public interface Role { + /** + * 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: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the password property: The password of the server group role. + * + * @return the password value. + */ + String password(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlhsc.fluent.models.RoleInner object. + * + * @return the inner object. + */ + RoleInner innerModel(); + + /** The entirety of the Role definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Role definition stages. */ + interface DefinitionStages { + /** The first stage of the Role definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Role definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @return the next definition stage. + */ + WithCreate withExistingServerGroupsv2(String resourceGroupName, String serverGroupName); + } + /** + * The stage of the Role 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.WithPassword { + /** + * Executes the create request. + * + * @return the created resource. + */ + Role create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Role create(Context context); + } + /** The stage of the Role definition allowing to specify password. */ + interface WithPassword { + /** + * Specifies the password property: The password of the server group role.. + * + * @param password The password of the server group role. + * @return the next definition stage. + */ + WithCreate withPassword(String password); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/RoleListResult.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/RoleListResult.java new file mode 100644 index 0000000000000..616ed2fbda280 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/RoleListResult.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.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.RoleInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of roles. */ +@Fluent +public final class RoleListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoleListResult.class); + + /* + * The list of roles in a server group. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of roles in a server group. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of roles in a server group. + * + * @param value the value value to set. + * @return the RoleListResult object itself. + */ + public RoleListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Roles.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Roles.java new file mode 100644 index 0000000000000..b5c05329b69e0 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Roles.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Roles. */ +public interface Roles { + /** + * Deletes a server group role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverGroupName, String roleName); + + /** + * Deletes a server group role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param roleName The name of the server group role name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverGroupName, String roleName, Context context); + + /** + * List all the roles in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of roles. + */ + PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName); + + /** + * List all the roles in a given server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of roles. + */ + PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName, Context context); + + /** + * Deletes a server group role. + * + * @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 group role. + * + * @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 Role resource. + * + * @param name resource name. + * @return the first stage of the new Role definition. + */ + Role.DefinitionStages.Blank define(String name); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerConfiguration.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerConfiguration.java new file mode 100644 index 0000000000000..48b0d02ef6662 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerConfiguration.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.postgresqlhsc.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationInner; + +/** An immutable client-side representation of ServerConfiguration. */ +public interface ServerConfiguration { + /** + * 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: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the value property: Value of the configuration. + * + * @return the value value. + */ + String value(); + + /** + * Gets the source property: Source of the configuration. + * + * @return the source value. + */ + String source(); + + /** + * 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 inner com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationInner object. + * + * @return the inner object. + */ + ServerConfigurationInner innerModel(); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerConfigurationListResult.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerConfigurationListResult.java new file mode 100644 index 0000000000000..b83146d902e23 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerConfigurationListResult.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.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server configurations. */ +@Fluent +public final class ServerConfigurationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerConfigurationListResult.class); + + /* + * The list of server configurations. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of 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 ServerConfigurationListResult object itself. + */ + public ServerConfigurationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * 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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerEdition.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerEdition.java new file mode 100644 index 0000000000000..54bc1b6832d71 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerEdition.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServerEdition. */ +public final class ServerEdition extends ExpandableStringEnum { + /** Static value GeneralPurpose for ServerEdition. */ + public static final ServerEdition GENERAL_PURPOSE = fromString("GeneralPurpose"); + + /** Static value MemoryOptimized for ServerEdition. */ + public static final ServerEdition MEMORY_OPTIMIZED = fromString("MemoryOptimized"); + + /** + * Creates or finds a ServerEdition from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerEdition. + */ + @JsonCreator + public static ServerEdition fromString(String name) { + return fromString(name, ServerEdition.class); + } + + /** @return known ServerEdition values. */ + public static Collection values() { + return values(ServerEdition.class); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroup.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroup.java new file mode 100644 index 0000000000000..8ba9891c44be3 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroup.java @@ -0,0 +1,776 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ServerGroup. */ +public interface ServerGroup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the createMode property: The mode to create a new server group. + * + * @return the createMode value. + */ + CreateMode createMode(); + + /** + * Gets the administratorLogin property: The administrator's login name of servers in server group. 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 password of the administrator login. + * + * @return the administratorLoginPassword value. + */ + String administratorLoginPassword(); + + /** + * Gets the backupRetentionDays property: The backup retention days for server group. + * + * @return the backupRetentionDays value. + */ + Integer backupRetentionDays(); + + /** + * Gets the postgresqlVersion property: The PostgreSQL version of server group. + * + * @return the postgresqlVersion value. + */ + PostgreSqlVersion postgresqlVersion(); + + /** + * Gets the citusVersion property: The Citus version of server group. + * + * @return the citusVersion value. + */ + CitusVersion citusVersion(); + + /** + * Gets the enableMx property: If Citus MX is enabled or not for the server group. + * + * @return the enableMx value. + */ + Boolean enableMx(); + + /** + * Gets the enableZfs property: If ZFS compression is enabled or not for the server group. + * + * @return the enableZfs value. + */ + Boolean enableZfs(); + + /** + * Gets the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the server group. + * + * @return the enableShardsOnCoordinator value. + */ + Boolean enableShardsOnCoordinator(); + + /** + * Gets the state property: A state of a server group that is visible to user. + * + * @return the state value. + */ + ServerState state(); + + /** + * Gets the earliestRestoreTime property: The earliest restore point time (ISO8601 format) for server group. + * + * @return the earliestRestoreTime value. + */ + OffsetDateTime earliestRestoreTime(); + + /** + * Gets the resourceProviderType property: The resource provider type of server group. + * + * @return the resourceProviderType value. + */ + ResourceProviderType resourceProviderType(); + + /** + * Gets the serverRoleGroups property: The list of server role groups. + * + * @return the serverRoleGroups value. + */ + List serverRoleGroups(); + + /** + * Gets the maintenanceWindow property: Maintenance window of a server group. + * + * @return the maintenanceWindow value. + */ + MaintenanceWindow maintenanceWindow(); + + /** + * Gets the availabilityZone property: Availability Zone information of the server group. + * + * @return the availabilityZone value. + */ + String availabilityZone(); + + /** + * Gets the standbyAvailabilityZone property: Standby Availability Zone information of the server group. + * + * @return the standbyAvailabilityZone value. + */ + String standbyAvailabilityZone(); + + /** + * Gets the delegatedSubnetArguments property: The delegated subnet arguments for a server group. + * + * @return the delegatedSubnetArguments value. + */ + ServerGroupPropertiesDelegatedSubnetArguments delegatedSubnetArguments(); + + /** + * Gets the privateDnsZoneArguments property: The private dns zone arguments for a server group. + * + * @return the privateDnsZoneArguments value. + */ + ServerGroupPropertiesPrivateDnsZoneArguments privateDnsZoneArguments(); + + /** + * Gets the readReplicas property: The array of read replica server groups. + * + * @return the readReplicas value. + */ + List readReplicas(); + + /** + * Gets the sourceServerGroup property: The source server group id for read replica server groups. + * + * @return the sourceServerGroup value. + */ + String sourceServerGroup(); + + /** + * Gets the sourceSubscriptionId property: The source subscription id to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @return the sourceSubscriptionId value. + */ + String sourceSubscriptionId(); + + /** + * Gets the sourceResourceGroupName property: The source resource group name to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @return the sourceResourceGroupName value. + */ + String sourceResourceGroupName(); + + /** + * Gets the sourceServerGroupName property: The source server group name to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @return the sourceServerGroupName value. + */ + String sourceServerGroupName(); + + /** + * Gets the sourceLocation property: The source server group location to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @return the sourceLocation value. + */ + String sourceLocation(); + + /** + * Gets the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore + * from. It's required when 'createMode' is 'PointInTimeRestore'. + * + * @return the pointInTimeUtc value. + */ + OffsetDateTime pointInTimeUtc(); + + /** + * 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 inner com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupInner object. + * + * @return the inner object. + */ + ServerGroupInner innerModel(); + + /** The entirety of the ServerGroup definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The ServerGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerGroup definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ServerGroup 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 ServerGroup 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 ServerGroup 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.WithCreateMode, + DefinitionStages.WithAdministratorLogin, + DefinitionStages.WithAdministratorLoginPassword, + DefinitionStages.WithBackupRetentionDays, + DefinitionStages.WithPostgresqlVersion, + DefinitionStages.WithCitusVersion, + DefinitionStages.WithEnableMx, + DefinitionStages.WithEnableZfs, + DefinitionStages.WithEnableShardsOnCoordinator, + DefinitionStages.WithServerRoleGroups, + DefinitionStages.WithMaintenanceWindow, + DefinitionStages.WithAvailabilityZone, + DefinitionStages.WithStandbyAvailabilityZone, + DefinitionStages.WithDelegatedSubnetArguments, + DefinitionStages.WithPrivateDnsZoneArguments, + DefinitionStages.WithSourceSubscriptionId, + DefinitionStages.WithSourceResourceGroupName, + DefinitionStages.WithSourceServerGroupName, + DefinitionStages.WithSourceLocation, + DefinitionStages.WithPointInTimeUtc { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerGroup create(Context context); + } + /** The stage of the ServerGroup 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 ServerGroup definition allowing to specify createMode. */ + interface WithCreateMode { + /** + * Specifies the createMode property: The mode to create a new server group.. + * + * @param createMode The mode to create a new server group. + * @return the next definition stage. + */ + WithCreate withCreateMode(CreateMode createMode); + } + /** The stage of the ServerGroup definition allowing to specify administratorLogin. */ + interface WithAdministratorLogin { + /** + * Specifies the administratorLogin property: The administrator's login name of servers in server group. Can + * only be specified when the server is being created (and is required for creation).. + * + * @param administratorLogin The administrator's login name of servers in server group. 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 ServerGroup definition 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. + */ + WithCreate withAdministratorLoginPassword(String administratorLoginPassword); + } + /** The stage of the ServerGroup definition allowing to specify backupRetentionDays. */ + interface WithBackupRetentionDays { + /** + * Specifies the backupRetentionDays property: The backup retention days for server group.. + * + * @param backupRetentionDays The backup retention days for server group. + * @return the next definition stage. + */ + WithCreate withBackupRetentionDays(Integer backupRetentionDays); + } + /** The stage of the ServerGroup definition allowing to specify postgresqlVersion. */ + interface WithPostgresqlVersion { + /** + * Specifies the postgresqlVersion property: The PostgreSQL version of server group.. + * + * @param postgresqlVersion The PostgreSQL version of server group. + * @return the next definition stage. + */ + WithCreate withPostgresqlVersion(PostgreSqlVersion postgresqlVersion); + } + /** The stage of the ServerGroup definition allowing to specify citusVersion. */ + interface WithCitusVersion { + /** + * Specifies the citusVersion property: The Citus version of server group.. + * + * @param citusVersion The Citus version of server group. + * @return the next definition stage. + */ + WithCreate withCitusVersion(CitusVersion citusVersion); + } + /** The stage of the ServerGroup definition allowing to specify enableMx. */ + interface WithEnableMx { + /** + * Specifies the enableMx property: If Citus MX is enabled or not for the server group.. + * + * @param enableMx If Citus MX is enabled or not for the server group. + * @return the next definition stage. + */ + WithCreate withEnableMx(Boolean enableMx); + } + /** The stage of the ServerGroup definition allowing to specify enableZfs. */ + interface WithEnableZfs { + /** + * Specifies the enableZfs property: If ZFS compression is enabled or not for the server group.. + * + * @param enableZfs If ZFS compression is enabled or not for the server group. + * @return the next definition stage. + */ + WithCreate withEnableZfs(Boolean enableZfs); + } + /** The stage of the ServerGroup definition allowing to specify enableShardsOnCoordinator. */ + interface WithEnableShardsOnCoordinator { + /** + * Specifies the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the + * server group.. + * + * @param enableShardsOnCoordinator If shards on coordinator is enabled or not for the server group. + * @return the next definition stage. + */ + WithCreate withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator); + } + /** The stage of the ServerGroup definition allowing to specify serverRoleGroups. */ + interface WithServerRoleGroups { + /** + * Specifies the serverRoleGroups property: The list of server role groups.. + * + * @param serverRoleGroups The list of server role groups. + * @return the next definition stage. + */ + WithCreate withServerRoleGroups(List serverRoleGroups); + } + /** The stage of the ServerGroup definition allowing to specify maintenanceWindow. */ + interface WithMaintenanceWindow { + /** + * Specifies the maintenanceWindow property: Maintenance window of a server group.. + * + * @param maintenanceWindow Maintenance window of a server group. + * @return the next definition stage. + */ + WithCreate withMaintenanceWindow(MaintenanceWindow maintenanceWindow); + } + /** The stage of the ServerGroup definition allowing to specify availabilityZone. */ + interface WithAvailabilityZone { + /** + * Specifies the availabilityZone property: Availability Zone information of the server group.. + * + * @param availabilityZone Availability Zone information of the server group. + * @return the next definition stage. + */ + WithCreate withAvailabilityZone(String availabilityZone); + } + /** The stage of the ServerGroup definition allowing to specify standbyAvailabilityZone. */ + interface WithStandbyAvailabilityZone { + /** + * Specifies the standbyAvailabilityZone property: Standby Availability Zone information of the server + * group.. + * + * @param standbyAvailabilityZone Standby Availability Zone information of the server group. + * @return the next definition stage. + */ + WithCreate withStandbyAvailabilityZone(String standbyAvailabilityZone); + } + /** The stage of the ServerGroup definition allowing to specify delegatedSubnetArguments. */ + interface WithDelegatedSubnetArguments { + /** + * Specifies the delegatedSubnetArguments property: The delegated subnet arguments for a server group.. + * + * @param delegatedSubnetArguments The delegated subnet arguments for a server group. + * @return the next definition stage. + */ + WithCreate withDelegatedSubnetArguments( + ServerGroupPropertiesDelegatedSubnetArguments delegatedSubnetArguments); + } + /** The stage of the ServerGroup definition allowing to specify privateDnsZoneArguments. */ + interface WithPrivateDnsZoneArguments { + /** + * Specifies the privateDnsZoneArguments property: The private dns zone arguments for a server group.. + * + * @param privateDnsZoneArguments The private dns zone arguments for a server group. + * @return the next definition stage. + */ + WithCreate withPrivateDnsZoneArguments( + ServerGroupPropertiesPrivateDnsZoneArguments privateDnsZoneArguments); + } + /** The stage of the ServerGroup definition allowing to specify sourceSubscriptionId. */ + interface WithSourceSubscriptionId { + /** + * Specifies the sourceSubscriptionId property: The source subscription id to restore from. It's required + * when 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @param sourceSubscriptionId The source subscription id to restore from. It's required when 'createMode' + * is 'PointInTimeRestore' or 'ReadReplica'. + * @return the next definition stage. + */ + WithCreate withSourceSubscriptionId(String sourceSubscriptionId); + } + /** The stage of the ServerGroup definition allowing to specify sourceResourceGroupName. */ + interface WithSourceResourceGroupName { + /** + * Specifies the sourceResourceGroupName property: The source resource group name to restore from. It's + * required when 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @param sourceResourceGroupName The source resource group name to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * @return the next definition stage. + */ + WithCreate withSourceResourceGroupName(String sourceResourceGroupName); + } + /** The stage of the ServerGroup definition allowing to specify sourceServerGroupName. */ + interface WithSourceServerGroupName { + /** + * Specifies the sourceServerGroupName property: The source server group name to restore from. It's required + * when 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @param sourceServerGroupName The source server group name to restore from. It's required when + * 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * @return the next definition stage. + */ + WithCreate withSourceServerGroupName(String sourceServerGroupName); + } + /** The stage of the ServerGroup definition allowing to specify sourceLocation. */ + interface WithSourceLocation { + /** + * Specifies the sourceLocation property: The source server group location to restore from. It's required + * when 'createMode' is 'PointInTimeRestore' or 'ReadReplica'. + * + * @param sourceLocation The source server group location to restore from. It's required when 'createMode' + * is 'PointInTimeRestore' or 'ReadReplica'. + * @return the next definition stage. + */ + WithCreate withSourceLocation(String sourceLocation); + } + /** The stage of the ServerGroup definition allowing to specify pointInTimeUtc. */ + interface WithPointInTimeUtc { + /** + * Specifies the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time + * to restore from. It's required when 'createMode' is 'PointInTimeRestore'. + * + * @param pointInTimeUtc Restore point creation time (ISO8601 format), specifying the time to restore from. + * It's required when 'createMode' is 'PointInTimeRestore'. + * @return the next definition stage. + */ + WithCreate withPointInTimeUtc(OffsetDateTime pointInTimeUtc); + } + } + /** + * Begins update for the ServerGroup resource. + * + * @return the stage of resource update. + */ + ServerGroup.Update update(); + + /** The template for ServerGroup update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithAdministratorLoginPassword, + UpdateStages.WithBackupRetentionDays, + UpdateStages.WithPostgresqlVersion, + UpdateStages.WithCitusVersion, + UpdateStages.WithEnableShardsOnCoordinator, + UpdateStages.WithServerRoleGroups, + UpdateStages.WithMaintenanceWindow, + UpdateStages.WithAvailabilityZone, + UpdateStages.WithStandbyAvailabilityZone { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerGroup apply(Context context); + } + /** The ServerGroup update stages. */ + interface UpdateStages { + /** The stage of the ServerGroup 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 ServerGroup 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 ServerGroup update allowing to specify backupRetentionDays. */ + interface WithBackupRetentionDays { + /** + * Specifies the backupRetentionDays property: The backup retention days for server group.. + * + * @param backupRetentionDays The backup retention days for server group. + * @return the next definition stage. + */ + Update withBackupRetentionDays(Integer backupRetentionDays); + } + /** The stage of the ServerGroup update allowing to specify postgresqlVersion. */ + interface WithPostgresqlVersion { + /** + * Specifies the postgresqlVersion property: The PostgreSQL version of server group.. + * + * @param postgresqlVersion The PostgreSQL version of server group. + * @return the next definition stage. + */ + Update withPostgresqlVersion(PostgreSqlVersion postgresqlVersion); + } + /** The stage of the ServerGroup update allowing to specify citusVersion. */ + interface WithCitusVersion { + /** + * Specifies the citusVersion property: The Citus version of server group.. + * + * @param citusVersion The Citus version of server group. + * @return the next definition stage. + */ + Update withCitusVersion(CitusVersion citusVersion); + } + /** The stage of the ServerGroup update allowing to specify enableShardsOnCoordinator. */ + interface WithEnableShardsOnCoordinator { + /** + * Specifies the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the + * server group.. + * + * @param enableShardsOnCoordinator If shards on coordinator is enabled or not for the server group. + * @return the next definition stage. + */ + Update withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator); + } + /** The stage of the ServerGroup update allowing to specify serverRoleGroups. */ + interface WithServerRoleGroups { + /** + * Specifies the serverRoleGroups property: The list of server role groups.. + * + * @param serverRoleGroups The list of server role groups. + * @return the next definition stage. + */ + Update withServerRoleGroups(List serverRoleGroups); + } + /** The stage of the ServerGroup update allowing to specify maintenanceWindow. */ + interface WithMaintenanceWindow { + /** + * Specifies the maintenanceWindow property: Maintenance window of a server group.. + * + * @param maintenanceWindow Maintenance window of a server group. + * @return the next definition stage. + */ + Update withMaintenanceWindow(MaintenanceWindow maintenanceWindow); + } + /** The stage of the ServerGroup update allowing to specify availabilityZone. */ + interface WithAvailabilityZone { + /** + * Specifies the availabilityZone property: Availability Zone information of the server group.. + * + * @param availabilityZone Availability Zone information of the server group. + * @return the next definition stage. + */ + Update withAvailabilityZone(String availabilityZone); + } + /** The stage of the ServerGroup update allowing to specify standbyAvailabilityZone. */ + interface WithStandbyAvailabilityZone { + /** + * Specifies the standbyAvailabilityZone property: Standby Availability Zone information of the server + * group.. + * + * @param standbyAvailabilityZone Standby Availability Zone information of the server group. + * @return the next definition stage. + */ + Update withStandbyAvailabilityZone(String standbyAvailabilityZone); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerGroup refresh(Context context); + + /** + * Restarts the server group. + * + * @throws com.azure.core.management.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 the server group. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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(Context context); + + /** + * Starts the server group. + * + * @throws com.azure.core.management.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 the server group. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 the server group. + * + * @throws com.azure.core.management.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 the server group. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupConfiguration.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupConfiguration.java new file mode 100644 index 0000000000000..1f7bfefe8f15c --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupConfiguration.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupConfigurationInner; +import java.util.List; + +/** An immutable client-side representation of ServerGroupConfiguration. */ +public interface ServerGroupConfiguration { + /** + * 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: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the description property: Description of the configuration. + * + * @return the description value. + */ + String description(); + + /** + * 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 serverRoleGroupConfigurations property: The list of server role group configuration values. + * + * @return the serverRoleGroupConfigurations value. + */ + List serverRoleGroupConfigurations(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupConfigurationInner object. + * + * @return the inner object. + */ + ServerGroupConfigurationInner innerModel(); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupConfigurationListResult.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupConfigurationListResult.java new file mode 100644 index 0000000000000..776602904df1f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupConfigurationListResult.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.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupConfigurationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server group configurations. */ +@Fluent +public final class ServerGroupConfigurationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerGroupConfigurationListResult.class); + + /* + * The list of server group configurations. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of server group configurations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of server group configurations. + * + * @param value the value value to set. + * @return the ServerGroupConfigurationListResult object itself. + */ + public ServerGroupConfigurationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * 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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupForUpdate.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupForUpdate.java new file mode 100644 index 0000000000000..0fb9ef9697395 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupForUpdate.java @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupPropertiesForUpdate; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Represents a server group for update. */ +@Fluent +public final class ServerGroupForUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerGroupForUpdate.class); + + /* + * The location the resource resides in. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Properties of the server group. + */ + @JsonProperty(value = "properties") + private ServerGroupPropertiesForUpdate innerProperties; + + /* + * Application-specific metadata in the form of key-value pairs. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the location property: The location the resource resides in. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location the resource resides in. + * + * @param location the location value to set. + * @return the ServerGroupForUpdate object itself. + */ + public ServerGroupForUpdate withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the innerProperties property: Properties of the server group. + * + * @return the innerProperties value. + */ + private ServerGroupPropertiesForUpdate 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 ServerGroupForUpdate object itself. + */ + public ServerGroupForUpdate 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 ServerGroupForUpdate object itself. + */ + public ServerGroupForUpdate withAdministratorLoginPassword(String administratorLoginPassword) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupPropertiesForUpdate(); + } + this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + /** + * Get the backupRetentionDays property: The backup retention days for server group. + * + * @return the backupRetentionDays value. + */ + public Integer backupRetentionDays() { + return this.innerProperties() == null ? null : this.innerProperties().backupRetentionDays(); + } + + /** + * Set the backupRetentionDays property: The backup retention days for server group. + * + * @param backupRetentionDays the backupRetentionDays value to set. + * @return the ServerGroupForUpdate object itself. + */ + public ServerGroupForUpdate withBackupRetentionDays(Integer backupRetentionDays) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupPropertiesForUpdate(); + } + this.innerProperties().withBackupRetentionDays(backupRetentionDays); + return this; + } + + /** + * Get the postgresqlVersion property: The PostgreSQL version of server group. + * + * @return the postgresqlVersion value. + */ + public PostgreSqlVersion postgresqlVersion() { + return this.innerProperties() == null ? null : this.innerProperties().postgresqlVersion(); + } + + /** + * Set the postgresqlVersion property: The PostgreSQL version of server group. + * + * @param postgresqlVersion the postgresqlVersion value to set. + * @return the ServerGroupForUpdate object itself. + */ + public ServerGroupForUpdate withPostgresqlVersion(PostgreSqlVersion postgresqlVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupPropertiesForUpdate(); + } + this.innerProperties().withPostgresqlVersion(postgresqlVersion); + return this; + } + + /** + * Get the citusVersion property: The Citus version of server group. + * + * @return the citusVersion value. + */ + public CitusVersion citusVersion() { + return this.innerProperties() == null ? null : this.innerProperties().citusVersion(); + } + + /** + * Set the citusVersion property: The Citus version of server group. + * + * @param citusVersion the citusVersion value to set. + * @return the ServerGroupForUpdate object itself. + */ + public ServerGroupForUpdate withCitusVersion(CitusVersion citusVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupPropertiesForUpdate(); + } + this.innerProperties().withCitusVersion(citusVersion); + return this; + } + + /** + * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the server group. + * + * @return the enableShardsOnCoordinator value. + */ + public Boolean enableShardsOnCoordinator() { + return this.innerProperties() == null ? null : this.innerProperties().enableShardsOnCoordinator(); + } + + /** + * Set the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the server group. + * + * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. + * @return the ServerGroupForUpdate object itself. + */ + public ServerGroupForUpdate withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupPropertiesForUpdate(); + } + this.innerProperties().withEnableShardsOnCoordinator(enableShardsOnCoordinator); + return this; + } + + /** + * Get the serverRoleGroups property: The list of server role groups. + * + * @return the serverRoleGroups value. + */ + public List serverRoleGroups() { + return this.innerProperties() == null ? null : this.innerProperties().serverRoleGroups(); + } + + /** + * Set the serverRoleGroups property: The list of server role groups. + * + * @param serverRoleGroups the serverRoleGroups value to set. + * @return the ServerGroupForUpdate object itself. + */ + public ServerGroupForUpdate withServerRoleGroups(List serverRoleGroups) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupPropertiesForUpdate(); + } + this.innerProperties().withServerRoleGroups(serverRoleGroups); + return this; + } + + /** + * Get the maintenanceWindow property: Maintenance window of a server group. + * + * @return the maintenanceWindow value. + */ + public MaintenanceWindow maintenanceWindow() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceWindow(); + } + + /** + * Set the maintenanceWindow property: Maintenance window of a server group. + * + * @param maintenanceWindow the maintenanceWindow value to set. + * @return the ServerGroupForUpdate object itself. + */ + public ServerGroupForUpdate withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupPropertiesForUpdate(); + } + this.innerProperties().withMaintenanceWindow(maintenanceWindow); + return this; + } + + /** + * Get the availabilityZone property: Availability Zone information of the server group. + * + * @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 group. + * + * @param availabilityZone the availabilityZone value to set. + * @return the ServerGroupForUpdate object itself. + */ + public ServerGroupForUpdate withAvailabilityZone(String availabilityZone) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupPropertiesForUpdate(); + } + this.innerProperties().withAvailabilityZone(availabilityZone); + return this; + } + + /** + * Get the standbyAvailabilityZone property: Standby Availability Zone information of the server group. + * + * @return the standbyAvailabilityZone value. + */ + public String standbyAvailabilityZone() { + return this.innerProperties() == null ? null : this.innerProperties().standbyAvailabilityZone(); + } + + /** + * Set the standbyAvailabilityZone property: Standby Availability Zone information of the server group. + * + * @param standbyAvailabilityZone the standbyAvailabilityZone value to set. + * @return the ServerGroupForUpdate object itself. + */ + public ServerGroupForUpdate withStandbyAvailabilityZone(String standbyAvailabilityZone) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerGroupPropertiesForUpdate(); + } + this.innerProperties().withStandbyAvailabilityZone(standbyAvailabilityZone); + 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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupListResult.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupListResult.java new file mode 100644 index 0000000000000..f573962504df8 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupListResult.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.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server groups. */ +@Fluent +public final class ServerGroupListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerGroupListResult.class); + + /* + * The list of server groups + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link used to get the next page of operations. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of server groups. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of server groups. + * + * @param value the value value to set. + * @return the ServerGroupListResult object itself. + */ + public ServerGroupListResult 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; + } + + /** + * 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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupPropertiesDelegatedSubnetArguments.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupPropertiesDelegatedSubnetArguments.java new file mode 100644 index 0000000000000..cb3041e781d93 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupPropertiesDelegatedSubnetArguments.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The delegated subnet arguments for a server group. */ +@Fluent +public final class ServerGroupPropertiesDelegatedSubnetArguments { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ServerGroupPropertiesDelegatedSubnetArguments.class); + + /* + * delegated subnet arm resource id. + */ + @JsonProperty(value = "subnetArmResourceId") + private String subnetArmResourceId; + + /** + * Get the subnetArmResourceId property: delegated subnet arm resource id. + * + * @return the subnetArmResourceId value. + */ + public String subnetArmResourceId() { + return this.subnetArmResourceId; + } + + /** + * Set the subnetArmResourceId property: delegated subnet arm resource id. + * + * @param subnetArmResourceId the subnetArmResourceId value to set. + * @return the ServerGroupPropertiesDelegatedSubnetArguments object itself. + */ + public ServerGroupPropertiesDelegatedSubnetArguments withSubnetArmResourceId(String subnetArmResourceId) { + this.subnetArmResourceId = subnetArmResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupPropertiesPrivateDnsZoneArguments.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupPropertiesPrivateDnsZoneArguments.java new file mode 100644 index 0000000000000..fed0707da9f21 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupPropertiesPrivateDnsZoneArguments.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.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The private dns zone arguments for a server group. */ +@Fluent +public final class ServerGroupPropertiesPrivateDnsZoneArguments { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ServerGroupPropertiesPrivateDnsZoneArguments.class); + + /* + * private dns zone arm resource id. + */ + @JsonProperty(value = "privateDnsZoneArmResourceId") + private String privateDnsZoneArmResourceId; + + /** + * Get the privateDnsZoneArmResourceId property: private dns zone arm resource id. + * + * @return the privateDnsZoneArmResourceId value. + */ + public String privateDnsZoneArmResourceId() { + return this.privateDnsZoneArmResourceId; + } + + /** + * Set the privateDnsZoneArmResourceId property: private dns zone arm resource id. + * + * @param privateDnsZoneArmResourceId the privateDnsZoneArmResourceId value to set. + * @return the ServerGroupPropertiesPrivateDnsZoneArguments object itself. + */ + public ServerGroupPropertiesPrivateDnsZoneArguments 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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupServer.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupServer.java new file mode 100644 index 0000000000000..85263d4dff373 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupServer.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.postgresqlhsc.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupServerInner; + +/** An immutable client-side representation of ServerGroupServer. */ +public interface ServerGroupServer { + /** + * 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: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * + * @return the fullyQualifiedDomainName value. + */ + String fullyQualifiedDomainName(); + + /** + * Gets the role property: The role of server in the server group. + * + * @return the role value. + */ + ServerRole role(); + + /** + * Gets the state property: A state of a server that is visible to user. + * + * @return the state value. + */ + ServerState state(); + + /** + * Gets the haState property: A state of a server group that is visible to user for HA feature. + * + * @return the haState value. + */ + ServerHaState haState(); + + /** + * Gets the administratorLogin property: The administrator's login name of a servers in server group. + * + * @return the administratorLogin value. + */ + String administratorLogin(); + + /** + * Gets the postgresqlVersion property: The PostgreSQL version of server. + * + * @return the postgresqlVersion value. + */ + PostgreSqlVersion postgresqlVersion(); + + /** + * Gets the citusVersion property: The Citus version of server. + * + * @return the citusVersion value. + */ + CitusVersion citusVersion(); + + /** + * Gets the availabilityZone property: Availability Zone information of the server group. + * + * @return the availabilityZone value. + */ + String availabilityZone(); + + /** + * Gets the standbyAvailabilityZone property: Standby Availability Zone information of the server group. + * + * @return the standbyAvailabilityZone value. + */ + String standbyAvailabilityZone(); + + /** + * Gets the serverEdition property: The edition of a server (default: GeneralPurpose). + * + * @return the serverEdition value. + */ + ServerEdition serverEdition(); + + /** + * Gets the storageQuotaInMb property: The storage of a server in MB (max: 2097152 = 2TiB). + * + * @return the storageQuotaInMb value. + */ + Long storageQuotaInMb(); + + /** + * Gets the vCores property: The vCores count of a server (max: 64). + * + * @return the vCores value. + */ + Long vCores(); + + /** + * Gets the enableHa property: If high availability is enabled or not for the server. + * + * @return the enableHa value. + */ + Boolean enableHa(); + + /** + * Gets the enablePublicIp property: If public IP is requested or not for a server. + * + * @return the enablePublicIp value. + */ + Boolean enablePublicIp(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupServerInner object. + * + * @return the inner object. + */ + ServerGroupServerInner innerModel(); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupServerListResult.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupServerListResult.java new file mode 100644 index 0000000000000..796a8ebd12a5d --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroupServerListResult.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.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupServerInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of servers in a server group. */ +@Fluent +public final class ServerGroupServerListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerGroupServerListResult.class); + + /* + * The list of servers in a server group. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of servers in a server group. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of servers in a server group. + * + * @param value the value value to set. + * @return the ServerGroupServerListResult object itself. + */ + public ServerGroupServerListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroups.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroups.java new file mode 100644 index 0000000000000..0c668c16e6b35 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerGroups.java @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.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 ServerGroups. */ +public interface ServerGroups { + /** + * List all the server groups 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 server groups. + */ + PagedIterable list(); + + /** + * List all the server groups 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 server groups. + */ + PagedIterable list(Context context); + + /** + * List all the server groups 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 server groups. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all the server groups 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 server groups. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets information about a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 group. + */ + ServerGroup getByResourceGroup(String resourceGroupName, String serverGroupName); + + /** + * Gets information about a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 group. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String serverGroupName, Context context); + + /** + * Deletes a server group together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverGroupName); + + /** + * Deletes a server group together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverGroupName, Context context); + + /** + * Restarts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverGroupName); + + /** + * Restarts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverGroupName, Context context); + + /** + * Starts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverGroupName); + + /** + * Starts the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverGroupName, Context context); + + /** + * Stops the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverGroupName); + + /** + * Stops the server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverGroupName, 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 checkNameAvailability(NameAvailabilityRequest 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. + */ + Response checkNameAvailabilityWithResponse( + NameAvailabilityRequest nameAvailabilityRequest, Context context); + + /** + * Gets information about a server group. + * + * @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 group. + */ + ServerGroup getById(String id); + + /** + * Gets information about a server group. + * + * @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 group. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a server group together with servers in it. + * + * @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 group together with servers in it. + * + * @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 ServerGroup resource. + * + * @param name resource name. + * @return the first stage of the new ServerGroup definition. + */ + ServerGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerHaState.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerHaState.java new file mode 100644 index 0000000000000..1144d4adddda5 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerHaState.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.postgresqlhsc.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServerHaState. */ +public final class ServerHaState extends ExpandableStringEnum { + /** Static value NotEnabled for ServerHaState. */ + public static final ServerHaState NOT_ENABLED = fromString("NotEnabled"); + + /** Static value CreatingStandby for ServerHaState. */ + public static final ServerHaState CREATING_STANDBY = fromString("CreatingStandby"); + + /** Static value ReplicatingData for ServerHaState. */ + public static final ServerHaState REPLICATING_DATA = fromString("ReplicatingData"); + + /** Static value FailingOver for ServerHaState. */ + public static final ServerHaState FAILING_OVER = fromString("FailingOver"); + + /** Static value Healthy for ServerHaState. */ + public static final ServerHaState HEALTHY = fromString("Healthy"); + + /** Static value RemovingStandby for ServerHaState. */ + public static final ServerHaState REMOVING_STANDBY = fromString("RemovingStandby"); + + /** Static value NotSync for ServerHaState. */ + public static final ServerHaState NOT_SYNC = fromString("NotSync"); + + /** + * Creates or finds a ServerHaState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerHaState. + */ + @JsonCreator + public static ServerHaState fromString(String name) { + return fromString(name, ServerHaState.class); + } + + /** @return known ServerHaState values. */ + public static Collection values() { + return values(ServerHaState.class); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerNameItem.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerNameItem.java new file mode 100644 index 0000000000000..ced3144425206 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerNameItem.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.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The name object for a server. */ +@Fluent +public final class ServerNameItem { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerNameItem.class); + + /* + * The name of a server. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The fully qualified domain name of a server. + */ + @JsonProperty(value = "fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /** + * Get the name property: The name of a server. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of a server. + * + * @param name the name value to set. + * @return the ServerNameItem object itself. + */ + public ServerNameItem withName(String name) { + this.name = name; + return this; + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerProperties.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerProperties.java new file mode 100644 index 0000000000000..5c4e21bd9ecec --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerProperties.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.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a server. */ +@Fluent +public class ServerProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerProperties.class); + + /* + * The edition of a server (default: GeneralPurpose). + */ + @JsonProperty(value = "serverEdition") + private ServerEdition serverEdition; + + /* + * The storage of a server in MB (max: 2097152 = 2TiB). + */ + @JsonProperty(value = "storageQuotaInMb") + private Long storageQuotaInMb; + + /* + * The vCores count of a server (max: 64). + */ + @JsonProperty(value = "vCores") + private Long vCores; + + /* + * If high availability is enabled or not for the server. + */ + @JsonProperty(value = "enableHa") + private Boolean enableHa; + + /* + * If public IP is requested or not for a server. + */ + @JsonProperty(value = "enablePublicIp", access = JsonProperty.Access.WRITE_ONLY) + private Boolean enablePublicIp; + + /** + * Get the serverEdition property: The edition of a server (default: GeneralPurpose). + * + * @return the serverEdition value. + */ + public ServerEdition serverEdition() { + return this.serverEdition; + } + + /** + * Set the serverEdition property: The edition of a server (default: GeneralPurpose). + * + * @param serverEdition the serverEdition value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withServerEdition(ServerEdition serverEdition) { + this.serverEdition = serverEdition; + return this; + } + + /** + * Get the storageQuotaInMb property: The storage of a server in MB (max: 2097152 = 2TiB). + * + * @return the storageQuotaInMb value. + */ + public Long storageQuotaInMb() { + return this.storageQuotaInMb; + } + + /** + * Set the storageQuotaInMb property: The storage of a server in MB (max: 2097152 = 2TiB). + * + * @param storageQuotaInMb the storageQuotaInMb value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withStorageQuotaInMb(Long storageQuotaInMb) { + this.storageQuotaInMb = storageQuotaInMb; + return this; + } + + /** + * Get the vCores property: The vCores count of a server (max: 64). + * + * @return the vCores value. + */ + public Long vCores() { + return this.vCores; + } + + /** + * Set the vCores property: The vCores count of a server (max: 64). + * + * @param vCores the vCores value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withVCores(Long vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the enableHa property: If high availability is enabled or not for the server. + * + * @return the enableHa value. + */ + public Boolean enableHa() { + return this.enableHa; + } + + /** + * Set the enableHa property: If high availability is enabled or not for the server. + * + * @param enableHa the enableHa value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withEnableHa(Boolean enableHa) { + this.enableHa = enableHa; + return this; + } + + /** + * Get the enablePublicIp property: If public IP is requested or not for a server. + * + * @return the enablePublicIp value. + */ + public Boolean enablePublicIp() { + return this.enablePublicIp; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerRole.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerRole.java new file mode 100644 index 0000000000000..5ac2007bb0da9 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerRole.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServerRole. */ +public final class ServerRole extends ExpandableStringEnum { + /** Static value Coordinator for ServerRole. */ + public static final ServerRole COORDINATOR = fromString("Coordinator"); + + /** Static value Worker for ServerRole. */ + public static final ServerRole WORKER = fromString("Worker"); + + /** + * Creates or finds a ServerRole from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerRole. + */ + @JsonCreator + public static ServerRole fromString(String name) { + return fromString(name, ServerRole.class); + } + + /** @return known ServerRole values. */ + public static Collection values() { + return values(ServerRole.class); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerRoleGroup.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerRoleGroup.java new file mode 100644 index 0000000000000..a0b4eb31bfc9e --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerRoleGroup.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a server role group. */ +@Fluent +public final class ServerRoleGroup extends ServerProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerRoleGroup.class); + + /* + * The name of the server role group. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The role of servers in the server role group. + */ + @JsonProperty(value = "role") + private ServerRole role; + + /* + * The number of servers in the server role group. + */ + @JsonProperty(value = "serverCount") + private Integer serverCount; + + /* + * The list of server names in the server role group. + */ + @JsonProperty(value = "serverNames", access = JsonProperty.Access.WRITE_ONLY) + private List serverNames; + + /** + * Get the name property: The name of the server role group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the server role group. + * + * @param name the name value to set. + * @return the ServerRoleGroup object itself. + */ + public ServerRoleGroup withName(String name) { + this.name = name; + return this; + } + + /** + * Get the role property: The role of servers in the server role group. + * + * @return the role value. + */ + public ServerRole role() { + return this.role; + } + + /** + * Set the role property: The role of servers in the server role group. + * + * @param role the role value to set. + * @return the ServerRoleGroup object itself. + */ + public ServerRoleGroup withRole(ServerRole role) { + this.role = role; + return this; + } + + /** + * Get the serverCount property: The number of servers in the server role group. + * + * @return the serverCount value. + */ + public Integer serverCount() { + return this.serverCount; + } + + /** + * Set the serverCount property: The number of servers in the server role group. + * + * @param serverCount the serverCount value to set. + * @return the ServerRoleGroup object itself. + */ + public ServerRoleGroup withServerCount(Integer serverCount) { + this.serverCount = serverCount; + return this; + } + + /** + * Get the serverNames property: The list of server names in the server role group. + * + * @return the serverNames value. + */ + public List serverNames() { + return this.serverNames; + } + + /** {@inheritDoc} */ + @Override + public ServerRoleGroup withServerEdition(ServerEdition serverEdition) { + super.withServerEdition(serverEdition); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerRoleGroup withStorageQuotaInMb(Long storageQuotaInMb) { + super.withStorageQuotaInMb(storageQuotaInMb); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerRoleGroup withVCores(Long vCores) { + super.withVCores(vCores); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerRoleGroup withEnableHa(Boolean enableHa) { + super.withEnableHa(enableHa); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (serverNames() != null) { + serverNames().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerRoleGroupConfiguration.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerRoleGroupConfiguration.java new file mode 100644 index 0000000000000..9b6bb449afe66 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerRoleGroupConfiguration.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents server role group configuration value. */ +@Fluent +public final class ServerRoleGroupConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerRoleGroupConfiguration.class); + + /* + * The role of servers in the server role group. + */ + @JsonProperty(value = "role", required = true) + private ServerRole role; + + /* + * Value of the configuration. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /* + * Default value of the configuration. + */ + @JsonProperty(value = "defaultValue", access = JsonProperty.Access.WRITE_ONLY) + private String defaultValue; + + /* + * Source of the configuration. + */ + @JsonProperty(value = "source", access = JsonProperty.Access.WRITE_ONLY) + private String source; + + /** + * Get the role property: The role of servers in the server role group. + * + * @return the role value. + */ + public ServerRole role() { + return this.role; + } + + /** + * Set the role property: The role of servers in the server role group. + * + * @param role the role value to set. + * @return the ServerRoleGroupConfiguration object itself. + */ + public ServerRoleGroupConfiguration withRole(ServerRole role) { + this.role = role; + return this; + } + + /** + * 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 ServerRoleGroupConfiguration object itself. + */ + public ServerRoleGroupConfiguration withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the defaultValue property: Default value of the configuration. + * + * @return the defaultValue value. + */ + public String defaultValue() { + return this.defaultValue; + } + + /** + * Get the source property: Source of the configuration. + * + * @return the source value. + */ + public String source() { + return this.source; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (role() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property role in model ServerRoleGroupConfiguration")); + } + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model ServerRoleGroupConfiguration")); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerState.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerState.java new file mode 100644 index 0000000000000..5170c3964deb3 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerState.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.postgresqlhsc.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServerState. */ +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"); + + /** Static value Provisioning for ServerState. */ + public static final ServerState PROVISIONING = fromString("Provisioning"); + + /** + * 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); + } + + /** @return known ServerState values. */ + public static Collection values() { + return values(ServerState.class); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Servers.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Servers.java new file mode 100644 index 0000000000000..d8d5671e04da5 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Servers.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.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 { + /** + * Lists servers of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 in a server group. + */ + PagedIterable listByServerGroup(String resourceGroupName, String serverGroupName); + + /** + * Lists servers of a server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 in a server group. + */ + PagedIterable listByServerGroup( + String resourceGroupName, String serverGroupName, Context context); + + /** + * Gets information about a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @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 in server group. + */ + ServerGroupServer get(String resourceGroupName, String serverGroupName, String serverName); + + /** + * Gets information about a server in server group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverGroupName The name of the server group. + * @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 in server group. + */ + Response getWithResponse( + String resourceGroupName, String serverGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/package-info.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/package-info.java new file mode 100644 index 0000000000000..b94729f9890ba --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/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 MicrosoftPostgreSqlHyperscale. The Microsoft Azure management API provides + * create, read, update, and delete functionality for Azure PostgreSQL Hyperscale (Citus) resources including server + * groups, servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations. + */ +package com.azure.resourcemanager.postgresqlhsc.models; diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/package-info.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/package-info.java new file mode 100644 index 0000000000000..facfcf4859fd0 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/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 MicrosoftPostgreSqlHyperscale. The Microsoft Azure management API provides create, + * read, update, and delete functionality for Azure PostgreSQL Hyperscale (Citus) resources including server groups, + * servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations. + */ +package com.azure.resourcemanager.postgresqlhsc; diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/module-info.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/module-info.java new file mode 100644 index 0000000000000..6e6d2cd05373e --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/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.postgresqlhsc { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.postgresqlhsc; + exports com.azure.resourcemanager.postgresqlhsc.fluent; + exports com.azure.resourcemanager.postgresqlhsc.fluent.models; + exports com.azure.resourcemanager.postgresqlhsc.models; + + opens com.azure.resourcemanager.postgresqlhsc.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.postgresqlhsc.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsGetSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsGetSamples.java new file mode 100644 index 0000000000000..1442f58faa6ec --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for Configurations Get. */ +public final class ConfigurationsGetSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ConfigurationGet.json + */ + /** + * Sample code: Get single configuration of the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getSingleConfigurationOfTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.configurations().getWithResponse("TestResourceGroup", "hsctestsg", "array_nulls", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsListByServerGroupSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsListByServerGroupSamples.java new file mode 100644 index 0000000000000..204aa3982ab14 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsListByServerGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for Configurations ListByServerGroup. */ +public final class ConfigurationsListByServerGroupSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ConfigurationListByServerGroup.json + */ + /** + * Sample code: List configurations of the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listConfigurationsOfTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.configurations().listByServerGroup("TestResourceGroup", "hsctestsg", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsListByServerSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsListByServerSamples.java new file mode 100644 index 0000000000000..267e32cdb282c --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for Configurations ListByServer. */ +public final class ConfigurationsListByServerSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ConfigurationListByServer.json + */ + /** + * Sample code: List configurations of the server that in the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listConfigurationsOfTheServerThatInTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.configurations().listByServer("TestResourceGroup", "hsctestsg", "testserver", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsUpdateSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsUpdateSamples.java new file mode 100644 index 0000000000000..8f6f30f66b8d2 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsUpdateSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerGroupConfigurationInner; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRole; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRoleGroupConfiguration; +import java.util.Arrays; + +/** Samples for Configurations Update. */ +public final class ConfigurationsUpdateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ConfigurationUpdate.json + */ + /** + * Sample code: Update single configuration of the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateSingleConfigurationOfTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .configurations() + .update( + "TestResourceGroup", + "hsctestsg", + "array_nulls", + new ServerGroupConfigurationInner() + .withServerRoleGroupConfigurations( + Arrays + .asList( + new ServerRoleGroupConfiguration().withRole(ServerRole.COORDINATOR).withValue("on"), + new ServerRoleGroupConfiguration().withRole(ServerRole.WORKER).withValue("off"))), + Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesCreateOrUpdateSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..886eea83a9a6b --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesCreateOrUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +/** Samples for FirewallRules CreateOrUpdate. */ +public final class FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/FirewallRuleCreate.json + */ + /** + * Sample code: Create a firewall rule of the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void createAFirewallRuleOfTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .firewallRules() + .define("rule1") + .withExistingServerGroupsv2("TestGroup", "pgtestsvc4") + .withStartIpAddress("0.0.0.0") + .withEndIpAddress("255.255.255.255") + .create(); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesDeleteSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesDeleteSamples.java new file mode 100644 index 0000000000000..a679a8d40d119 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallRules Delete. */ +public final class FirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/FirewallRuleDelete.json + */ + /** + * Sample code: Delete the firewall rule of the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void deleteTheFirewallRuleOfTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.firewallRules().delete("TestGroup", "pgtestsvc4", "rule1", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesGetSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesGetSamples.java new file mode 100644 index 0000000000000..f84590b143a3a --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallRules Get. */ +public final class FirewallRulesGetSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/FirewallRuleGet.json + */ + /** + * Sample code: Get the firewall rule of the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getTheFirewallRuleOfTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.firewallRules().getWithResponse("TestGroup", "pgtestsvc4", "rule1", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesListByServerGroupSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesListByServerGroupSamples.java new file mode 100644 index 0000000000000..32fbe16aed84f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesListByServerGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallRules ListByServerGroup. */ +public final class FirewallRulesListByServerGroupSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/FirewallRuleListByServerGroup.json + */ + /** + * Sample code: List firewall rules of the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listFirewallRulesOfTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.firewallRules().listByServerGroup("TestGroup", "pgtestsvc4", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/OperationsListSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..52ea19bb02e8b --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/OperationsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/OperationList.json + */ + /** + * Sample code: List all available operations. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listAllAvailableOperations( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/RolesCreateSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/RolesCreateSamples.java new file mode 100644 index 0000000000000..5e48fc7fd7f0d --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/RolesCreateSamples.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.postgresqlhsc.generated; + +/** Samples for Roles Create. */ +public final class RolesCreateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/RoleCreate.json + */ + /** + * Sample code: RoleCreate. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void roleCreate(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .roles() + .define("role1") + .withExistingServerGroupsv2("TestGroup", "pgtestsvc4") + .withPassword("secret") + .create(); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/RolesDeleteSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/RolesDeleteSamples.java new file mode 100644 index 0000000000000..acb15cdb00f3d --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/RolesDeleteSamples.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.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for Roles Delete. */ +public final class RolesDeleteSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/RoleDelete.json + */ + /** + * Sample code: RoleDelete. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void roleDelete(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.roles().delete("TestGroup", "pgtestsvc4", "role1", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/RolesListByServerGroupSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/RolesListByServerGroupSamples.java new file mode 100644 index 0000000000000..2099efe57e4d5 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/RolesListByServerGroupSamples.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.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for Roles ListByServerGroup. */ +public final class RolesListByServerGroupSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/RoleListByServerGroup.json + */ + /** + * Sample code: RoleList. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void roleList(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.roles().listByServerGroup("TestGroup", "pgtestsvc4", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsCheckNameAvailabilitySamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..1b5947a2502b2 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsCheckNameAvailabilitySamples.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.postgresqlhsc.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.models.NameAvailabilityRequest; + +/** Samples for ServerGroups CheckNameAvailability. */ +public final class ServerGroupsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/CheckNameAvailability.json + */ + /** + * Sample code: Check name availability. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void checkNameAvailability(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .serverGroups() + .checkNameAvailabilityWithResponse(new NameAvailabilityRequest().withName("name1"), Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsCreateOrUpdateSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..de698d62fcb7d --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsCreateOrUpdateSamples.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.resourcemanager.postgresqlhsc.models.CitusVersion; +import com.azure.resourcemanager.postgresqlhsc.models.CreateMode; +import com.azure.resourcemanager.postgresqlhsc.models.PostgreSqlVersion; +import com.azure.resourcemanager.postgresqlhsc.models.ServerEdition; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupPropertiesDelegatedSubnetArguments; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroupPropertiesPrivateDnsZoneArguments; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRole; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRoleGroup; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ServerGroups CreateOrUpdate. */ +public final class ServerGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupCreateReadReplica.json + */ + /** + * Sample code: Create a new server group as a read replica. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void createANewServerGroupAsAReadReplica( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .serverGroups() + .define("hsctestsg") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withCreateMode(CreateMode.READ_REPLICA) + .withSourceSubscriptionId("dddddddd-dddd-dddd-dddd-dddddddddddd") + .withSourceResourceGroupName("SourceGroup") + .withSourceServerGroupName("pgtests-source-server-group") + .withSourceLocation("eastus") + .create(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupCreate.json + */ + /** + * Sample code: Create a new server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void createANewServerGroup(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .serverGroups() + .define("hsctestsg") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withTags(mapOf("ElasticServer", "1")) + .withAdministratorLogin("citus") + .withAdministratorLoginPassword("password") + .withBackupRetentionDays(35) + .withPostgresqlVersion(PostgreSqlVersion.ONE_TWO) + .withCitusVersion(CitusVersion.NINE_FIVE) + .withEnableMx(true) + .withEnableZfs(false) + .withServerRoleGroups( + Arrays + .asList( + new ServerRoleGroup() + .withServerEdition(ServerEdition.GENERAL_PURPOSE) + .withStorageQuotaInMb(524288L) + .withVCores(4L) + .withEnableHa(true) + .withName("") + .withRole(ServerRole.COORDINATOR) + .withServerCount(1), + new ServerRoleGroup() + .withServerEdition(ServerEdition.MEMORY_OPTIMIZED) + .withStorageQuotaInMb(524288L) + .withVCores(4L) + .withEnableHa(false) + .withName("") + .withRole(ServerRole.WORKER) + .withServerCount(3))) + .withAvailabilityZone("1") + .withStandbyAvailabilityZone("2") + .withDelegatedSubnetArguments( + new ServerGroupPropertiesDelegatedSubnetArguments() + .withSubnetArmResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet")) + .withPrivateDnsZoneArguments( + new ServerGroupPropertiesPrivateDnsZoneArguments() + .withPrivateDnsZoneArmResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone")) + .create(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupCreatePITR.json + */ + /** + * Sample code: Create a new server group as a point in time restore. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void createANewServerGroupAsAPointInTimeRestore( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .serverGroups() + .define("hsctestsg") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) + .withEnableMx(true) + .withEnableZfs(false) + .withSourceSubscriptionId("dddddddd-dddd-dddd-dddd-dddddddddddd") + .withSourceResourceGroupName("SourceGroup") + .withSourceServerGroupName("pgtests-source-server-group") + .withSourceLocation("eastus") + .withPointInTimeUtc(OffsetDateTime.parse("2017-12-14T00:00:37.467Z")) + .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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsDeleteSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsDeleteSamples.java new file mode 100644 index 0000000000000..0d97ed86c6453 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsDeleteSamples.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.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerGroups Delete. */ +public final class ServerGroupsDeleteSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupDelete.json + */ + /** + * Sample code: Delete the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void deleteTheServerGroup(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.serverGroups().delete("TestGroup", "testservergroup", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsGetByResourceGroupSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..287f83c377cf7 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsGetByResourceGroupSamples.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.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerGroups GetByResourceGroup. */ +public final class ServerGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupGet.json + */ + /** + * Sample code: Get the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getTheServerGroup(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.serverGroups().getByResourceGroupWithResponse("TestGroup", "hsctestsg1", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsListByResourceGroupSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..0a642b3db859e --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerGroups ListByResourceGroup. */ +public final class ServerGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupListByResourceGroup.json + */ + /** + * Sample code: List the server groups by resource group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listTheServerGroupsByResourceGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.serverGroups().listByResourceGroup("TestGroup", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsListSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsListSamples.java new file mode 100644 index 0000000000000..f6cffd81d8030 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsListSamples.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.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerGroups List. */ +public final class ServerGroupsListSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupList.json + */ + /** + * Sample code: List all the server groups. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listAllTheServerGroups(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.serverGroups().list(Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsRestartSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsRestartSamples.java new file mode 100644 index 0000000000000..41bcef9905b9a --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsRestartSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerGroups Restart. */ +public final class ServerGroupsRestartSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupRestart.json + */ + /** + * Sample code: Restart all servers in the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void restartAllServersInTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.serverGroups().restart("TestGroup", "hsctestsg1", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsStartSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsStartSamples.java new file mode 100644 index 0000000000000..ee3777400f0ad --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsStartSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerGroups Start. */ +public final class ServerGroupsStartSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupStart.json + */ + /** + * Sample code: Start all servers in the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void startAllServersInTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.serverGroups().start("TestGroup", "hsctestsg1", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsStopSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsStopSamples.java new file mode 100644 index 0000000000000..acbd06d3de8ed --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsStopSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerGroups Stop. */ +public final class ServerGroupsStopSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupStop.json + */ + /** + * Sample code: Stop all servers in the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void stopAllServersInTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.serverGroups().stop("TestGroup", "hsctestsg1", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsUpdateSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsUpdateSamples.java new file mode 100644 index 0000000000000..999ee6684cfb2 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServerGroupsUpdateSamples.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.postgresqlhsc.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlhsc.models.PostgreSqlVersion; +import com.azure.resourcemanager.postgresqlhsc.models.ServerEdition; +import com.azure.resourcemanager.postgresqlhsc.models.ServerGroup; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRole; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRoleGroup; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ServerGroups Update. */ +public final class ServerGroupsUpdateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupScaleStorage.json + */ + /** + * Sample code: Scale storage. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void scaleStorage(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ServerGroup resource = + manager.serverGroups().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource + .update() + .withServerRoleGroups( + Arrays + .asList( + new ServerRoleGroup().withStorageQuotaInMb(8388608L).withName("").withRole(ServerRole.WORKER))) + .apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupAddNode.json + */ + /** + * Sample code: Add new worker nodes. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void addNewWorkerNodes(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ServerGroup resource = + manager.serverGroups().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource + .update() + .withServerRoleGroups( + Arrays.asList(new ServerRoleGroup().withName("").withRole(ServerRole.WORKER).withServerCount(10))) + .apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupUpdateMaintenanceWindow.json + */ + /** + * Sample code: Update customer maintenance window. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateCustomerMaintenanceWindow( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ServerGroup resource = + manager.serverGroups().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource + .update() + .withMaintenanceWindow( + new MaintenanceWindow() + .withCustomWindow("Enabled") + .withStartHour(8) + .withStartMinute(0) + .withDayOfWeek(0)) + .apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupScaleCompute.json + */ + /** + * Sample code: Scale compute. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void scaleCompute(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ServerGroup resource = + manager.serverGroups().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource + .update() + .withServerRoleGroups( + Arrays.asList(new ServerRoleGroup().withVCores(16L).withName("").withRole(ServerRole.COORDINATOR))) + .apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupUpdate.json + */ + /** + * Sample code: Update the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateTheServerGroup(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ServerGroup resource = + manager.serverGroups().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("ElasticServer", "2")) + .withAdministratorLoginPassword("secret") + .withBackupRetentionDays(30) + .withPostgresqlVersion(PostgreSqlVersion.ONE_TWO) + .withServerRoleGroups( + Arrays + .asList( + new ServerRoleGroup() + .withServerEdition(ServerEdition.GENERAL_PURPOSE) + .withStorageQuotaInMb(1048576L) + .withVCores(8L) + .withEnableHa(false) + .withName("") + .withRole(ServerRole.COORDINATOR) + .withServerCount(1), + new ServerRoleGroup() + .withServerEdition(ServerEdition.MEMORY_OPTIMIZED) + .withStorageQuotaInMb(524288L) + .withVCores(4L) + .withEnableHa(true) + .withName("") + .withRole(ServerRole.WORKER) + .withServerCount(4))) + .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/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServersGetSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServersGetSamples.java new file mode 100644 index 0000000000000..d8e7219d37998 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServersGetSamples.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.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for Servers Get. */ +public final class ServersGetSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGet.json + */ + /** + * Sample code: Get the server of server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getTheServerOfServerGroup(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.servers().getWithResponse("TestGroup", "hsctestsg1", "hsctestsg1-c", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServersListByServerGroupSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServersListByServerGroupSamples.java new file mode 100644 index 0000000000000..169c2b9271730 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServersListByServerGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for Servers ListByServerGroup. */ +public final class ServersListByServerGroupSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerListByServerGroup.json + */ + /** + * Sample code: List servers of the server group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listServersOfTheServerGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.servers().listByServerGroup("TestGroup", "hsctestsg1", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/ci.yml b/sdk/postgresqlhsc/ci.yml new file mode 100644 index 0000000000000..a682491dc6998 --- /dev/null +++ b/sdk/postgresqlhsc/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/postgresqlhsc/ci.yml + - sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/ + exclude: + - sdk/postgresqlhsc/pom.xml + - sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/postgresqlhsc/ci.yml + - sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/ + exclude: + - sdk/postgresqlhsc/pom.xml + - sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: postgresqlhsc + Artifacts: + - name: azure-resourcemanager-postgresqlhsc + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerpostgresqlhsc diff --git a/sdk/postgresqlhsc/pom.xml b/sdk/postgresqlhsc/pom.xml new file mode 100644 index 0000000000000..6815fef967d6a --- /dev/null +++ b/sdk/postgresqlhsc/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-postgresqlhsc-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-postgresqlhsc + + + +