diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 057fe35000c42..0f477d3fd6af3 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -390,6 +390,7 @@ com.azure.resourcemanager:azure-resourcemanager-securitydevops;1.0.0-beta.1;1.0. com.azure.resourcemanager:azure-resourcemanager-appcomplianceautomation;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-servicenetworking;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-recoveryservicessiterecovery;1.0.0-beta.1;1.0.0-beta.1 +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.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index adbcf11daf9dc..267f7ea8fe680 100644 --- a/pom.xml +++ b/pom.xml @@ -130,6 +130,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..3ff327681f8a4 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-01-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 Cosmos DB for PostgreSQL resources including clusters, servers, configurations, firewall rules, roles, private endpoint connections and private link resources. Package tag package-2022-11-08. 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..266a0911982bc --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/README.md @@ -0,0 +1,105 @@ +# 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 Cosmos DB for PostgreSQL resources including clusters, servers, configurations, firewall rules, roles, private endpoint connections and private link resources. Package tag package-2022-11-08. 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] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +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][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/SAMPLE.md b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/SAMPLE.md new file mode 100644 index 0000000000000..13e715df71bde --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/SAMPLE.md @@ -0,0 +1,937 @@ +# Code snippets and samples + + +## Clusters + +- [CheckNameAvailability](#clusters_checknameavailability) +- [CreateOrUpdate](#clusters_createorupdate) +- [Delete](#clusters_delete) +- [GetByResourceGroup](#clusters_getbyresourcegroup) +- [List](#clusters_list) +- [ListByResourceGroup](#clusters_listbyresourcegroup) +- [PromoteReadReplica](#clusters_promotereadreplica) +- [Restart](#clusters_restart) +- [Start](#clusters_start) +- [Stop](#clusters_stop) +- [Update](#clusters_update) + +## Configurations + +- [Get](#configurations_get) +- [ListByCluster](#configurations_listbycluster) +- [ListByServer](#configurations_listbyserver) +- [UpdateCoordinator](#configurations_updatecoordinator) +- [UpdateNode](#configurations_updatenode) + +## FirewallRules + +- [CreateOrUpdate](#firewallrules_createorupdate) +- [Delete](#firewallrules_delete) +- [Get](#firewallrules_get) +- [ListByCluster](#firewallrules_listbycluster) + +## Operations + +- [List](#operations_list) + +## PrivateEndpointConnections + +- [CreateOrUpdate](#privateendpointconnections_createorupdate) +- [Delete](#privateendpointconnections_delete) +- [Get](#privateendpointconnections_get) +- [ListByCluster](#privateendpointconnections_listbycluster) + +## PrivateLinkResources + +- [Get](#privatelinkresources_get) +- [ListByCluster](#privatelinkresources_listbycluster) + +## Roles + +- [Create](#roles_create) +- [Delete](#roles_delete) +- [ListByCluster](#roles_listbycluster) + +## Servers + +- [Get](#servers_get) +- [ListByCluster](#servers_listbycluster) +### Clusters_CheckNameAvailability + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.models.NameAvailabilityRequest; + +/** Samples for Clusters CheckNameAvailability. */ +public final class ClustersCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/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 + .clusters() + .checkNameAvailabilityWithResponse(new NameAvailabilityRequest().withName("name1"), Context.NONE); + } +} +``` + +### Clusters_CreateOrUpdate + +```java +import java.util.HashMap; +import java.util.Map; + +/** Samples for Clusters CreateOrUpdate. */ +public final class ClustersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateReadReplica.json + */ + /** + * Sample code: Create a new cluster as a read replica. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void createANewClusterAsAReadReplica( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .clusters() + .define("hsctestsg") + .withExistingResourceGroup("TestGroup") + .withRegion("westus") + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/pgtests-source-cluster") + .withSourceLocation("westus") + .create(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreatePITR.json + */ + /** + * Sample code: Create a new cluster as a point in time restore. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void createANewClusterAsAPointInTimeRestore( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .clusters() + .define("hsctestsg") + .withExistingResourceGroup("TestGroup") + .withRegion("westus") + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/pgtests-source-cluster") + .withSourceLocation("westus") + .create(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreate.json + */ + /** + * Sample code: Create a new cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void createANewCluster(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .clusters() + .define("hsctestsg") + .withExistingResourceGroup("TestGroup") + .withRegion("westus") + .withTags(mapOf()) + .withAdministratorLoginPassword("p@ssword1234") + .withPostgresqlVersion("15") + .withCitusVersion("11.1") + .withEnableShardsOnCoordinator(false) + .withEnableHa(true) + .withPreferredPrimaryZone("1") + .withCoordinatorServerEdition("GeneralPurpose") + .withCoordinatorStorageQuotaInMb(524288L) + .withCoordinatorVCores(4L) + .withCoordinatorEnablePublicIpAccess(true) + .withNodeServerEdition("MemoryOptimized") + .withNodeCount(3L) + .withNodeStorageQuotaInMb(524288L) + .withNodeVCores(8L) + .withNodeEnablePublicIpAccess(false) + .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; + } +} +``` + +### Clusters_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Clusters Delete. */ +public final class ClustersDeleteSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterDelete.json + */ + /** + * Sample code: Delete the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void deleteTheCluster(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().delete("TestGroup", "testcluster", Context.NONE); + } +} +``` + +### Clusters_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Clusters GetByResourceGroup. */ +public final class ClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterGet.json + */ + /** + * Sample code: Get the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getTheCluster(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().getByResourceGroupWithResponse("TestGroup", "hsctestsg1", Context.NONE); + } +} +``` + +### Clusters_List + +```java +import com.azure.core.util.Context; + +/** Samples for Clusters List. */ +public final class ClustersListSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterList.json + */ + /** + * Sample code: List all the clusters. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listAllTheClusters(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().list(Context.NONE); + } +} +``` + +### Clusters_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Clusters ListByResourceGroup. */ +public final class ClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterListByResourceGroup.json + */ + /** + * Sample code: List the clusters by resource group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listTheClustersByResourceGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().listByResourceGroup("TestGroup", Context.NONE); + } +} +``` + +### Clusters_PromoteReadReplica + +```java +import com.azure.core.util.Context; + +/** Samples for Clusters PromoteReadReplica. */ +public final class ClustersPromoteReadReplicaSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterPromoteReadReplica.json + */ + /** + * Sample code: Promote the read replica. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void promoteTheReadReplica(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().promoteReadReplica("TestGroup", "hsctestsg1", Context.NONE); + } +} +``` + +### Clusters_Restart + +```java +import com.azure.core.util.Context; + +/** Samples for Clusters Restart. */ +public final class ClustersRestartSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterRestart.json + */ + /** + * Sample code: Restart all servers in the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void restartAllServersInTheCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().restart("TestGroup", "hsctestsg1", Context.NONE); + } +} +``` + +### Clusters_Start + +```java +import com.azure.core.util.Context; + +/** Samples for Clusters Start. */ +public final class ClustersStartSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterStart.json + */ + /** + * Sample code: Start all servers in the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void startAllServersInTheCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().start("TestGroup", "hsctestsg1", Context.NONE); + } +} +``` + +### Clusters_Stop + +```java +import com.azure.core.util.Context; + +/** Samples for Clusters Stop. */ +public final class ClustersStopSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterStop.json + */ + /** + * Sample code: Stop all servers in the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void stopAllServersInTheCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().stop("TestGroup", "hsctestsg1", Context.NONE); + } +} +``` + +### Clusters_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.models.ClusterResponse; +import com.azure.resourcemanager.postgresqlhsc.models.MaintenanceWindow; + +/** Samples for Clusters Update. */ +public final class ClustersUpdateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterScaleStorage.json + */ + /** + * Sample code: Scale storage. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void scaleStorage(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ClusterResponse resource = + manager.clusters().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource.update().withNodeStorageQuotaInMb(2097152L).apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterAddNode.json + */ + /** + * Sample code: Add new worker nodes. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void addNewWorkerNodes(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ClusterResponse resource = + manager.clusters().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource.update().withNodeCount(2L).apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterUpdateMaintenanceWindow.json + */ + /** + * Sample code: Update customer maintenance window. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateCustomerMaintenanceWindow( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ClusterResponse resource = + manager.clusters().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/stable/2022-11-08/examples/ClusterUpdate.json + */ + /** + * Sample code: Update the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateTheCluster(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ClusterResponse resource = + manager.clusters().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource + .update() + .withAdministratorLoginPassword("newP@ssword1") + .withCoordinatorVCores(16L) + .withNodeCount(4L) + .withNodeVCores(16L) + .apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterScaleCompute.json + */ + /** + * Sample code: Scale compute. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void scaleCompute(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ClusterResponse resource = + manager.clusters().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource.update().withNodeVCores(16L).apply(); + } +} +``` + +### 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/stable/2022-11-08/examples/ConfigurationGet.json + */ + /** + * Sample code: Get configuration details. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getConfigurationDetails(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.configurations().getWithResponse("TestResourceGroup", "hsctestsg", "array_nulls", Context.NONE); + } +} +``` + +### Configurations_ListByCluster + +```java +import com.azure.core.util.Context; + +/** Samples for Configurations ListByCluster. */ +public final class ConfigurationsListByClusterSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationListByCluster.json + */ + /** + * Sample code: List configurations of the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listConfigurationsOfTheCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.configurations().listByCluster("TestResourceGroup", "hsctestsg", 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/stable/2022-11-08/examples/ConfigurationListByServer.json + */ + /** + * Sample code: List configurations of the server that in the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listConfigurationsOfTheServerThatInTheCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.configurations().listByServer("TestResourceGroup", "hsctestsg", "testserver", Context.NONE); + } +} +``` + +### Configurations_UpdateCoordinator + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.models.ServerConfigurationRequest; + +/** Samples for Configurations UpdateCoordinator. */ +public final class ConfigurationsUpdateCoordinatorSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationUpdateCoordinator.json + */ + /** + * Sample code: Update single configuration of coordinator. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateSingleConfigurationOfCoordinator( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .configurations() + .updateCoordinator( + "TestResourceGroup", + "hsctestsg", + "array_nulls", + new ServerConfigurationRequest().withValue("on"), + Context.NONE); + } +} +``` + +### Configurations_UpdateNode + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.models.ServerConfigurationRequest; + +/** Samples for Configurations UpdateNode. */ +public final class ConfigurationsUpdateNodeSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationUpdateNode.json + */ + /** + * Sample code: Update single configuration of nodes. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateSingleConfigurationOfNodes( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .configurations() + .updateNode( + "TestResourceGroup", + "hsctestsg", + "array_nulls", + new ServerConfigurationRequest().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/stable/2022-11-08/examples/FirewallRuleCreate.json + */ + /** + * Sample code: Create a firewall rule of the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void createAFirewallRuleOfTheCluster( + 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/stable/2022-11-08/examples/FirewallRuleDelete.json + */ + /** + * Sample code: Delete the firewall rule of the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void deleteTheFirewallRuleOfTheCluster( + 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/stable/2022-11-08/examples/FirewallRuleGet.json + */ + /** + * Sample code: Get the firewall rule of the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getTheFirewallRuleOfTheCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.firewallRules().getWithResponse("TestGroup", "pgtestsvc4", "rule1", Context.NONE); + } +} +``` + +### FirewallRules_ListByCluster + +```java +import com.azure.core.util.Context; + +/** Samples for FirewallRules ListByCluster. */ +public final class FirewallRulesListByClusterSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/FirewallRuleListByCluster.json + */ + /** + * Sample code: List firewall rules of the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listFirewallRulesOfTheCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.firewallRules().listByCluster("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/stable/2022-11-08/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); + } +} +``` + +### PrivateEndpointConnections_CreateOrUpdate + +```java +import com.azure.resourcemanager.postgresqlhsc.models.PrivateLinkServiceConnectionState; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateEndpointConnectionCreateOrUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .privateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingServerGroupsv2("TestGroup", "hsctestsg") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withDescription("Approved by johndoe@contoso.com") + .withStatus("Approved")) + .create(); + } +} +``` + +### PrivateEndpointConnections_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateEndpointConnectionsDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .privateEndpointConnections() + .delete("TestGroup", "hsctestsg", "private-endpoint-connection-name", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateEndpointConnectionsGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .privateEndpointConnections() + .getWithResponse("TestGroup", "hsctestsg", "private-endpoint-connection-name", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_ListByCluster + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByCluster. */ +public final class PrivateEndpointConnectionsListByClusterSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateEndpointConnectionsListByCluster.json + */ + /** + * Sample code: Gets list of private endpoint connections on a cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnACluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.privateEndpointConnections().listByCluster("TestResourceGroup", "hsctestsg", Context.NONE); + } +} +``` + +### PrivateLinkResources_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateLinkResourcesGet.json + */ + /** + * Sample code: Gets a private link resource for cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getsAPrivateLinkResourceForCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.privateLinkResources().getWithResponse("TestGroup", "hsctestsg", "plr", Context.NONE); + } +} +``` + +### PrivateLinkResources_ListByCluster + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByCluster. */ +public final class PrivateLinkResourcesListByClusterSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateLinkResourceListByCluster.json + */ + /** + * Sample code: Gets the private link resources for cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getsThePrivateLinkResourcesForCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.privateLinkResources().listByCluster("TestResourceGroup", "hsctestsg", Context.NONE); + } +} +``` + +### Roles_Create + +```java +/** Samples for Roles Create. */ +public final class RolesCreateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/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/stable/2022-11-08/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_ListByCluster + +```java +import com.azure.core.util.Context; + +/** Samples for Roles ListByCluster. */ +public final class RolesListByClusterSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/RoleListByCluster.json + */ + /** + * Sample code: RoleList. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void roleList(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.roles().listByCluster("TestGroup", "pgtestsvc4", Context.NONE); + } +} +``` + +### 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/stable/2022-11-08/examples/ServerGet.json + */ + /** + * Sample code: Get the server of cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getTheServerOfCluster(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.servers().getWithResponse("TestGroup", "hsctestsg1", "hsctestsg1-c", Context.NONE); + } +} +``` + +### Servers_ListByCluster + +```java +import com.azure.core.util.Context; + +/** Samples for Servers ListByCluster. */ +public final class ServersListByClusterSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ServerListByCluster.json + */ + /** + * Sample code: List servers of the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listServersOfTheCluster(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.servers().listByCluster("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..fc1d1851f9242 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/pom.xml @@ -0,0 +1,55 @@ + + 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 Cosmos DB for PostgreSQL resources including clusters, servers, configurations, firewall rules, roles, private endpoint connections and private link resources. Package tag package-2022-11-08. + 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 + + + + com.azure + azure-core + 1.35.0 + + + com.azure + azure-core-management + 1.10.0 + + + 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..4e7b099293eed --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/PostgresqlhscManager.java @@ -0,0 +1,400 @@ +// 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.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.fluent.CosmosDBForPostgreSql; +import com.azure.resourcemanager.postgresqlhsc.implementation.ClustersImpl; +import com.azure.resourcemanager.postgresqlhsc.implementation.ConfigurationsImpl; +import com.azure.resourcemanager.postgresqlhsc.implementation.CosmosDBForPostgreSqlBuilder; +import com.azure.resourcemanager.postgresqlhsc.implementation.FirewallRulesImpl; +import com.azure.resourcemanager.postgresqlhsc.implementation.OperationsImpl; +import com.azure.resourcemanager.postgresqlhsc.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.postgresqlhsc.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.postgresqlhsc.implementation.RolesImpl; +import com.azure.resourcemanager.postgresqlhsc.implementation.ServersImpl; +import com.azure.resourcemanager.postgresqlhsc.models.Clusters; +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.PrivateEndpointConnections; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateLinkResources; +import com.azure.resourcemanager.postgresqlhsc.models.Roles; +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.UUID; +import java.util.stream.Collectors; + +/** + * Entry point to PostgresqlhscManager. The Microsoft Azure management API provides create, read, update, and delete + * functionality for Cosmos DB for PostgreSQL resources including clusters, servers, configurations, firewall rules, + * roles, private endpoint connections and private link resources. + */ +public final class PostgresqlhscManager { + private Clusters clusters; + + private Servers servers; + + private Configurations configurations; + + private FirewallRules firewallRules; + + private Roles roles; + + private Operations operations; + + private PrivateEndpointConnections privateEndpointConnections; + + private PrivateLinkResources privateLinkResources; + + private final CosmosDBForPostgreSql 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 CosmosDBForPostgreSqlBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(UUID.fromString(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); + } + + /** + * Creates an instance of postgresqlhsc service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the postgresqlhsc service API instance. + */ + public static PostgresqlhscManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new PostgresqlhscManager(httpPipeline, profile, null); + } + + /** + * 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 static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of 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) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new PostgresqlhscManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Clusters. It manages ClusterResponse. + * + * @return Resource collection API of Clusters. + */ + public Clusters clusters() { + if (this.clusters == null) { + this.clusters = new ClustersImpl(clientObject.getClusters(), this); + } + return clusters; + } + + /** + * Gets the resource collection API of Servers. + * + * @return Resource collection API of Servers. + */ + public Servers servers() { + if (this.servers == null) { + this.servers = new ServersImpl(clientObject.getServers(), this); + } + return servers; + } + + /** + * Gets the resource collection API of Configurations. + * + * @return Resource collection API of Configurations. + */ + public Configurations configurations() { + if (this.configurations == null) { + this.configurations = new ConfigurationsImpl(clientObject.getConfigurations(), this); + } + return configurations; + } + + /** + * Gets the resource collection API of FirewallRules. It manages FirewallRule. + * + * @return Resource collection API of FirewallRules. + */ + public FirewallRules firewallRules() { + if (this.firewallRules == null) { + this.firewallRules = new FirewallRulesImpl(clientObject.getFirewallRules(), this); + } + return firewallRules; + } + + /** + * Gets the resource collection API of Roles. It manages Role. + * + * @return Resource collection API of Roles. + */ + public Roles roles() { + if (this.roles == null) { + this.roles = new RolesImpl(clientObject.getRoles(), this); + } + return roles; + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of PrivateEndpointConnections. It manages PrivateEndpointConnectionProperty. + * + * @return Resource collection API of PrivateEndpointConnections. + */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = + new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** + * Gets the resource collection API of PrivateLinkResources. + * + * @return Resource collection API of PrivateLinkResources. + */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** + * @return Wrapped service client CosmosDBForPostgreSql providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public CosmosDBForPostgreSql serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/ClustersClient.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/ClustersClient.java new file mode 100644 index 0000000000000..440f9cb96b51b --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/ClustersClient.java @@ -0,0 +1,509 @@ +// 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.ClusterResponseInner; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.postgresqlhsc.models.Cluster; +import com.azure.resourcemanager.postgresqlhsc.models.ClusterForUpdate; +import com.azure.resourcemanager.postgresqlhsc.models.NameAvailabilityRequest; + +/** An instance of this class provides access to all the operations defined in ClustersClient. */ +public interface ClustersClient { + /** + * List all the clusters 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 clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all the clusters 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 clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List all the clusters 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 clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all the clusters 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 clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Creates a new cluster with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The required parameters for creating or updating a cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClusterResponseInner> beginCreateOrUpdate( + String resourceGroupName, String clusterName, Cluster parameters); + + /** + * Creates a new cluster with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The required parameters for creating or updating a cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClusterResponseInner> beginCreateOrUpdate( + String resourceGroupName, String clusterName, Cluster parameters, Context context); + + /** + * Creates a new cluster with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The required parameters for creating or updating a cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterResponseInner createOrUpdate(String resourceGroupName, String clusterName, Cluster parameters); + + /** + * Creates a new cluster with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The required parameters for creating or updating a cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterResponseInner createOrUpdate( + String resourceGroupName, String clusterName, Cluster parameters, Context context); + + /** + * Gets information about a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String clusterName, Context context); + + /** + * Gets information about a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterResponseInner getByResourceGroup(String resourceGroupName, String clusterName); + + /** + * Deletes a cluster together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String clusterName); + + /** + * Deletes a cluster together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String clusterName, Context context); + + /** + * Deletes a cluster together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName); + + /** + * Deletes a cluster together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName, Context context); + + /** + * Updates an existing cluster. The request body can contain one to many of the properties present in the normal + * cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The parameters for updating a cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClusterResponseInner> beginUpdate( + String resourceGroupName, String clusterName, ClusterForUpdate parameters); + + /** + * Updates an existing cluster. The request body can contain one to many of the properties present in the normal + * cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The parameters for updating a cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClusterResponseInner> beginUpdate( + String resourceGroupName, String clusterName, ClusterForUpdate parameters, Context context); + + /** + * Updates an existing cluster. The request body can contain one to many of the properties present in the normal + * cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The parameters for updating a cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterResponseInner update(String resourceGroupName, String clusterName, ClusterForUpdate parameters); + + /** + * Updates an existing cluster. The request body can contain one to many of the properties present in the normal + * cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The parameters for updating a cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterResponseInner update( + String resourceGroupName, String clusterName, ClusterForUpdate parameters, Context context); + + /** + * Restarts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart(String resourceGroupName, String clusterName); + + /** + * Restarts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart(String resourceGroupName, String clusterName, Context context); + + /** + * Restarts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName); + + /** + * Restarts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName, Context context); + + /** + * Starts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String clusterName); + + /** + * Starts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String clusterName, Context context); + + /** + * Starts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName); + + /** + * Starts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName, Context context); + + /** + * Stops the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStop(String resourceGroupName, String clusterName); + + /** + * Stops the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStop(String resourceGroupName, String clusterName, Context context); + + /** + * Stops the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName); + + /** + * Stops the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName, Context context); + + /** + * Promote the read replica cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPromoteReadReplica(String resourceGroupName, String clusterName); + + /** + * Promote the read replica cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPromoteReadReplica( + String resourceGroupName, String clusterName, Context context); + + /** + * Promote the read replica cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 promoteReadReplica(String resourceGroupName, String clusterName); + + /** + * Promote the read replica cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 promoteReadReplica(String resourceGroupName, String clusterName, Context context); + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + NameAvailabilityRequest nameAvailabilityRequest, Context context); + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NameAvailabilityInner checkNameAvailability(NameAvailabilityRequest nameAvailabilityRequest); +} 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..0580be8ed7635 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/ConfigurationsClient.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.ConfigurationInner; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationInner; +import com.azure.resourcemanager.postgresqlhsc.models.ServerConfigurationRequest; + +/** 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 cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String clusterName, String serverName); + + /** + * List all the configurations of a server in cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String clusterName, String serverName, Context context); + + /** + * List all the configurations of a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of cluster configurations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCluster(String resourceGroupName, String clusterName); + + /** + * List all the configurations of a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of cluster configurations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCluster(String resourceGroupName, String clusterName, Context context); + + /** + * Gets information of a configuration for coordinator and nodes. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster 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 of a configuration for coordinator and nodes along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String clusterName, String configurationName, Context context); + + /** + * Gets information of a configuration for coordinator and nodes. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster 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 of a configuration for coordinator and nodes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationInner get(String resourceGroupName, String clusterName, String configurationName); + + /** + * Updates configuration of coordinator in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerConfigurationInner> beginUpdateCoordinator( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest parameters); + + /** + * Updates configuration of coordinator in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerConfigurationInner> beginUpdateCoordinator( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest parameters, + Context context); + + /** + * Updates configuration of coordinator in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerConfigurationInner updateCoordinator( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest parameters); + + /** + * Updates configuration of coordinator in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerConfigurationInner updateCoordinator( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest parameters, + Context context); + + /** + * Updates configuration of nodes in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerConfigurationInner> beginUpdateNode( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest parameters); + + /** + * Updates configuration of nodes in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerConfigurationInner> beginUpdateNode( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest parameters, + Context context); + + /** + * Updates configuration of nodes in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerConfigurationInner updateNode( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest parameters); + + /** + * Updates configuration of nodes in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerConfigurationInner updateNode( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest parameters, + Context context); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/CosmosDBForPostgreSql.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/CosmosDBForPostgreSql.java new file mode 100644 index 0000000000000..ea7e0a9d509db --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/CosmosDBForPostgreSql.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; +import java.util.UUID; + +/** The interface for CosmosDBForPostgreSql class. */ +public interface CosmosDBForPostgreSql { + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + UUID 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 ClustersClient object to access its operations. + * + * @return the ClustersClient object. + */ + ClustersClient getClusters(); + + /** + * 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(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + PrivateLinkResourcesClient getPrivateLinkResources(); +} 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..e9567e8a57391 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/FirewallRulesClient.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, String clusterName, 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 clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String clusterName, + 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 clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner createOrUpdate( + String resourceGroupName, String clusterName, 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 clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner createOrUpdate( + String resourceGroupName, + String clusterName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context); + + /** + * Deletes a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, String firewallRuleName); + + /** + * Deletes a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, String firewallRuleName, Context context); + + /** + * Deletes a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 clusterName, String firewallRuleName); + + /** + * Deletes a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 clusterName, String firewallRuleName, Context context); + + /** + * Gets information about a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String clusterName, String firewallRuleName, Context context); + + /** + * Gets information about a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner get(String resourceGroupName, String clusterName, String firewallRuleName); + + /** + * List all the firewall rules in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCluster(String resourceGroupName, String clusterName); + + /** + * List all the firewall rules in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCluster(String resourceGroupName, String clusterName, Context context); +} 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..5386176def826 --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/PrivateEndpointConnectionsClient.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 0000000000000..98cd435793d8a --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/PrivateEndpointConnectionsClient.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.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.PrivateEndpointConnectionPropertyInner; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnectionActionRequest; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnectionsCreateOrUpdateResponse; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public interface PrivateEndpointConnectionsClient { + /** + * Gets list of private endpoint connections on a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections on a cluster as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCluster(String resourceGroupName, String clusterName); + + /** + * Gets list of private endpoint connections on a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections on a cluster as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCluster( + String resourceGroupName, String clusterName, Context context); + + /** + * Gets private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String clusterName, String privateEndpointConnectionName, Context context); + + /** + * Gets private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionPropertyInner get( + String resourceGroupName, String clusterName, String privateEndpointConnectionName); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The required parameters for approving a private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionsCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionActionRequest parameters, + Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The required parameters for approving a private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionPropertyInner createOrUpdate( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionActionRequest parameters); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String clusterName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String clusterName, String privateEndpointConnectionName, Context context); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/PrivateLinkResourcesClient.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 0000000000000..db42f00abc10f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/PrivateLinkResourcesClient.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.PrivateLinkResourceInner; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public interface PrivateLinkResourcesClient { + /** + * Gets the private link resources for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for cluster as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCluster(String resourceGroupName, String clusterName); + + /** + * Gets the private link resources for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for cluster as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCluster( + String resourceGroupName, String clusterName, Context context); + + /** + * Gets a private link resource for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateLinkResourceName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String clusterName, String privateLinkResourceName, Context context); + + /** + * Gets a private link resource for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateLinkResourceName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner get(String resourceGroupName, String clusterName, String privateLinkResourceName); +} 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..9c76c2bcc6c02 --- /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 clusterName The name of the cluster. + * @param roleName The name of the cluster role. + * @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 the {@link SyncPoller} for polling of represents a cluster role. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RoleInner> beginCreate( + String resourceGroupName, String clusterName, 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 clusterName The name of the cluster. + * @param roleName The name of the cluster role. + * @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 the {@link SyncPoller} for polling of represents a cluster role. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RoleInner> beginCreate( + String resourceGroupName, String clusterName, 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 clusterName The name of the cluster. + * @param roleName The name of the cluster role. + * @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 cluster role. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleInner create(String resourceGroupName, String clusterName, 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 clusterName The name of the cluster. + * @param roleName The name of the cluster role. + * @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 cluster role. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleInner create( + String resourceGroupName, String clusterName, String roleName, RoleInner parameters, Context context); + + /** + * Deletes a cluster role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param roleName The name of the cluster 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String clusterName, String roleName); + + /** + * Deletes a cluster role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param roleName The name of the cluster 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, String roleName, Context context); + + /** + * Deletes a cluster role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param roleName The name of the cluster 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String clusterName, String roleName); + + /** + * Deletes a cluster role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param roleName The name of the cluster 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String clusterName, String roleName, Context context); + + /** + * List all the roles in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCluster(String resourceGroupName, String clusterName); + + /** + * List all the roles in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCluster(String resourceGroupName, String clusterName, 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..c89d95edb93dd --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/ServersClient.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.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.ClusterServerInner; + +/** An instance of this class provides access to all the operations defined in ServersClient. */ +public interface ServersClient { + /** + * Lists servers of a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 cluster as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCluster(String resourceGroupName, String clusterName); + + /** + * Lists servers of a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 cluster as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCluster(String resourceGroupName, String clusterName, Context context); + + /** + * Gets information about a server in cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @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 cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String clusterName, String serverName, Context context); + + /** + * Gets information about a server in cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @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 cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterServerInner get(String resourceGroupName, String clusterName, String serverName); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterProperties.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterProperties.java new file mode 100644 index 0000000000000..aaa8d9092bbba --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterProperties.java @@ -0,0 +1,521 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlhsc.models.MaintenanceWindow; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties used to create a new cluster. */ +@Fluent +public final class ClusterProperties { + /* + * The password of the administrator login. Required for creation. + */ + @JsonProperty(value = "administratorLoginPassword") + private String administratorLoginPassword; + + /* + * The PostgreSQL version of cluster. + */ + @JsonProperty(value = "postgresqlVersion") + private String postgresqlVersion; + + /* + * The Citus version of cluster. + */ + @JsonProperty(value = "citusVersion") + private String citusVersion; + + /* + * If shards on coordinator is enabled or not for the cluster. + */ + @JsonProperty(value = "enableShardsOnCoordinator") + private Boolean enableShardsOnCoordinator; + + /* + * The earliest restore point time (ISO8601 format) for the cluster. + */ + @JsonProperty(value = "earliestRestoreTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime earliestRestoreTime; + + /* + * If high availability is enabled or not for the cluster. + */ + @JsonProperty(value = "enableHa") + private Boolean enableHa; + + /* + * Preferred primary zone for the cluster + */ + @JsonProperty(value = "preferredPrimaryZone") + private String preferredPrimaryZone; + + /* + * The edition of the coordinator (default: GeneralPurpose). Required for creation. + */ + @JsonProperty(value = "coordinatorServerEdition") + private String coordinatorServerEdition; + + /* + * The storage of the coordinator in MB. Required for creation. + */ + @JsonProperty(value = "coordinatorStorageQuotaInMb") + private Long coordinatorStorageQuotaInMb; + + /* + * The vCores count of the coordinator (max: 64). Required for creation. + */ + @JsonProperty(value = "coordinatorVCores") + private Long coordinatorVCores; + + /* + * If public IP is requested or not for the coordinator. + */ + @JsonProperty(value = "coordinatorEnablePublicIpAccess") + private Boolean coordinatorEnablePublicIpAccess; + + /* + * The edition of a node (default: MemoryOptimized). + */ + @JsonProperty(value = "nodeServerEdition") + private String nodeServerEdition; + + /* + * Worker node count of the cluster. When node count is 0, it represents a coordinator with the ability to create + * distributed tables on that node. Node count value can not be 1. + */ + @JsonProperty(value = "nodeCount") + private Long nodeCount; + + /* + * The storage of a node in MB. + */ + @JsonProperty(value = "nodeStorageQuotaInMb") + private Long nodeStorageQuotaInMb; + + /* + * The vCores count of a node (max: 64). + */ + @JsonProperty(value = "nodeVCores") + private Long nodeVCores; + + /* + * If public IP is requested or not for a node. + */ + @JsonProperty(value = "nodeEnablePublicIpAccess") + private Boolean nodeEnablePublicIpAccess; + + /* + * Maintenance window of a cluster. + */ + @JsonProperty(value = "maintenanceWindow") + private MaintenanceWindow maintenanceWindow; + + /* + * The source resource id to restore from. It's required for 'PointInTimeRestore' or 'ReadReplica' operations + */ + @JsonProperty(value = "sourceResourceId") + private String sourceResourceId; + + /* + * The source cluster location to restore from. It's required for 'PointInTimeRestore' or 'ReadReplica' operations + */ + @JsonProperty(value = "sourceLocation") + private String sourceLocation; + + /** Creates an instance of ClusterProperties class. */ + public ClusterProperties() { + } + + /** + * Get the administratorLoginPassword property: The password of the administrator login. Required for creation. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The password of the administrator login. Required for creation. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the postgresqlVersion property: The PostgreSQL version of cluster. + * + * @return the postgresqlVersion value. + */ + public String postgresqlVersion() { + return this.postgresqlVersion; + } + + /** + * Set the postgresqlVersion property: The PostgreSQL version of cluster. + * + * @param postgresqlVersion the postgresqlVersion value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withPostgresqlVersion(String postgresqlVersion) { + this.postgresqlVersion = postgresqlVersion; + return this; + } + + /** + * Get the citusVersion property: The Citus version of cluster. + * + * @return the citusVersion value. + */ + public String citusVersion() { + return this.citusVersion; + } + + /** + * Set the citusVersion property: The Citus version of cluster. + * + * @param citusVersion the citusVersion value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withCitusVersion(String citusVersion) { + this.citusVersion = citusVersion; + return this; + } + + /** + * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * + * @return the enableShardsOnCoordinator value. + */ + public Boolean enableShardsOnCoordinator() { + return this.enableShardsOnCoordinator; + } + + /** + * Set the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * + * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) { + this.enableShardsOnCoordinator = enableShardsOnCoordinator; + return this; + } + + /** + * Get the earliestRestoreTime property: The earliest restore point time (ISO8601 format) for the cluster. + * + * @return the earliestRestoreTime value. + */ + public OffsetDateTime earliestRestoreTime() { + return this.earliestRestoreTime; + } + + /** + * Get the enableHa property: If high availability is enabled or not for the cluster. + * + * @return the enableHa value. + */ + public Boolean enableHa() { + return this.enableHa; + } + + /** + * Set the enableHa property: If high availability is enabled or not for the cluster. + * + * @param enableHa the enableHa value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withEnableHa(Boolean enableHa) { + this.enableHa = enableHa; + return this; + } + + /** + * Get the preferredPrimaryZone property: Preferred primary zone for the cluster. + * + * @return the preferredPrimaryZone value. + */ + public String preferredPrimaryZone() { + return this.preferredPrimaryZone; + } + + /** + * Set the preferredPrimaryZone property: Preferred primary zone for the cluster. + * + * @param preferredPrimaryZone the preferredPrimaryZone value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withPreferredPrimaryZone(String preferredPrimaryZone) { + this.preferredPrimaryZone = preferredPrimaryZone; + return this; + } + + /** + * Get the coordinatorServerEdition property: The edition of the coordinator (default: GeneralPurpose). Required for + * creation. + * + * @return the coordinatorServerEdition value. + */ + public String coordinatorServerEdition() { + return this.coordinatorServerEdition; + } + + /** + * Set the coordinatorServerEdition property: The edition of the coordinator (default: GeneralPurpose). Required for + * creation. + * + * @param coordinatorServerEdition the coordinatorServerEdition value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withCoordinatorServerEdition(String coordinatorServerEdition) { + this.coordinatorServerEdition = coordinatorServerEdition; + return this; + } + + /** + * Get the coordinatorStorageQuotaInMb property: The storage of the coordinator in MB. Required for creation. + * + * @return the coordinatorStorageQuotaInMb value. + */ + public Long coordinatorStorageQuotaInMb() { + return this.coordinatorStorageQuotaInMb; + } + + /** + * Set the coordinatorStorageQuotaInMb property: The storage of the coordinator in MB. Required for creation. + * + * @param coordinatorStorageQuotaInMb the coordinatorStorageQuotaInMb value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withCoordinatorStorageQuotaInMb(Long coordinatorStorageQuotaInMb) { + this.coordinatorStorageQuotaInMb = coordinatorStorageQuotaInMb; + return this; + } + + /** + * Get the coordinatorVCores property: The vCores count of the coordinator (max: 64). Required for creation. + * + * @return the coordinatorVCores value. + */ + public Long coordinatorVCores() { + return this.coordinatorVCores; + } + + /** + * Set the coordinatorVCores property: The vCores count of the coordinator (max: 64). Required for creation. + * + * @param coordinatorVCores the coordinatorVCores value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withCoordinatorVCores(Long coordinatorVCores) { + this.coordinatorVCores = coordinatorVCores; + return this; + } + + /** + * Get the coordinatorEnablePublicIpAccess property: If public IP is requested or not for the coordinator. + * + * @return the coordinatorEnablePublicIpAccess value. + */ + public Boolean coordinatorEnablePublicIpAccess() { + return this.coordinatorEnablePublicIpAccess; + } + + /** + * Set the coordinatorEnablePublicIpAccess property: If public IP is requested or not for the coordinator. + * + * @param coordinatorEnablePublicIpAccess the coordinatorEnablePublicIpAccess value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withCoordinatorEnablePublicIpAccess(Boolean coordinatorEnablePublicIpAccess) { + this.coordinatorEnablePublicIpAccess = coordinatorEnablePublicIpAccess; + return this; + } + + /** + * Get the nodeServerEdition property: The edition of a node (default: MemoryOptimized). + * + * @return the nodeServerEdition value. + */ + public String nodeServerEdition() { + return this.nodeServerEdition; + } + + /** + * Set the nodeServerEdition property: The edition of a node (default: MemoryOptimized). + * + * @param nodeServerEdition the nodeServerEdition value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withNodeServerEdition(String nodeServerEdition) { + this.nodeServerEdition = nodeServerEdition; + return this; + } + + /** + * Get the nodeCount property: Worker node count of the cluster. When node count is 0, it represents a coordinator + * with the ability to create distributed tables on that node. Node count value can not be 1. + * + * @return the nodeCount value. + */ + public Long nodeCount() { + return this.nodeCount; + } + + /** + * Set the nodeCount property: Worker node count of the cluster. When node count is 0, it represents a coordinator + * with the ability to create distributed tables on that node. Node count value can not be 1. + * + * @param nodeCount the nodeCount value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withNodeCount(Long nodeCount) { + this.nodeCount = nodeCount; + return this; + } + + /** + * Get the nodeStorageQuotaInMb property: The storage of a node in MB. + * + * @return the nodeStorageQuotaInMb value. + */ + public Long nodeStorageQuotaInMb() { + return this.nodeStorageQuotaInMb; + } + + /** + * Set the nodeStorageQuotaInMb property: The storage of a node in MB. + * + * @param nodeStorageQuotaInMb the nodeStorageQuotaInMb value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withNodeStorageQuotaInMb(Long nodeStorageQuotaInMb) { + this.nodeStorageQuotaInMb = nodeStorageQuotaInMb; + return this; + } + + /** + * Get the nodeVCores property: The vCores count of a node (max: 64). + * + * @return the nodeVCores value. + */ + public Long nodeVCores() { + return this.nodeVCores; + } + + /** + * Set the nodeVCores property: The vCores count of a node (max: 64). + * + * @param nodeVCores the nodeVCores value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withNodeVCores(Long nodeVCores) { + this.nodeVCores = nodeVCores; + return this; + } + + /** + * Get the nodeEnablePublicIpAccess property: If public IP is requested or not for a node. + * + * @return the nodeEnablePublicIpAccess value. + */ + public Boolean nodeEnablePublicIpAccess() { + return this.nodeEnablePublicIpAccess; + } + + /** + * Set the nodeEnablePublicIpAccess property: If public IP is requested or not for a node. + * + * @param nodeEnablePublicIpAccess the nodeEnablePublicIpAccess value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withNodeEnablePublicIpAccess(Boolean nodeEnablePublicIpAccess) { + this.nodeEnablePublicIpAccess = nodeEnablePublicIpAccess; + return this; + } + + /** + * Get the maintenanceWindow property: Maintenance window of a cluster. + * + * @return the maintenanceWindow value. + */ + public MaintenanceWindow maintenanceWindow() { + return this.maintenanceWindow; + } + + /** + * Set the maintenanceWindow property: Maintenance window of a cluster. + * + * @param maintenanceWindow the maintenanceWindow value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + this.maintenanceWindow = maintenanceWindow; + return this; + } + + /** + * Get the sourceResourceId property: The source resource id to restore from. It's required for 'PointInTimeRestore' + * or 'ReadReplica' operations. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.sourceResourceId; + } + + /** + * Set the sourceResourceId property: The source resource id to restore from. It's required for 'PointInTimeRestore' + * or 'ReadReplica' operations. + * + * @param sourceResourceId the sourceResourceId value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withSourceResourceId(String sourceResourceId) { + this.sourceResourceId = sourceResourceId; + return this; + } + + /** + * Get the sourceLocation property: The source cluster location to restore from. It's required for + * 'PointInTimeRestore' or 'ReadReplica' operations. + * + * @return the sourceLocation value. + */ + public String sourceLocation() { + return this.sourceLocation; + } + + /** + * Set the sourceLocation property: The source cluster location to restore from. It's required for + * 'PointInTimeRestore' or 'ReadReplica' operations. + * + * @param sourceLocation the sourceLocation value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withSourceLocation(String sourceLocation) { + this.sourceLocation = sourceLocation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (maintenanceWindow() != null) { + maintenanceWindow().validate(); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterPropertiesForUpdate.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterPropertiesForUpdate.java new file mode 100644 index 0000000000000..28b5b361a8228 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterPropertiesForUpdate.java @@ -0,0 +1,436 @@ +// 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.resourcemanager.postgresqlhsc.models.MaintenanceWindow; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties used to update a cluster. */ +@Fluent +public final class ClusterPropertiesForUpdate { + /* + * The password of the administrator login. + */ + @JsonProperty(value = "administratorLoginPassword") + private String administratorLoginPassword; + + /* + * The PostgreSQL version of the cluster. + */ + @JsonProperty(value = "postgresqlVersion") + private String postgresqlVersion; + + /* + * The Citus version of the cluster. + */ + @JsonProperty(value = "citusVersion") + private String citusVersion; + + /* + * If shards on coordinator is enabled or not for the cluster. + */ + @JsonProperty(value = "enableShardsOnCoordinator") + private Boolean enableShardsOnCoordinator; + + /* + * If high availability is enabled or not for the cluster. + */ + @JsonProperty(value = "enableHa") + private Boolean enableHa; + + /* + * Preferred primary zone for the cluster + */ + @JsonProperty(value = "preferredPrimaryZone") + private String preferredPrimaryZone; + + /* + * The edition of the coordinator (default: GeneralPurpose). + */ + @JsonProperty(value = "coordinatorServerEdition") + private String coordinatorServerEdition; + + /* + * The storage of the coordinator in MB. + */ + @JsonProperty(value = "coordinatorStorageQuotaInMb") + private Long coordinatorStorageQuotaInMb; + + /* + * The vCores count of the coordinator (max: 64). + */ + @JsonProperty(value = "coordinatorVCores") + private Long coordinatorVCores; + + /* + * If public IP is requested or not for the coordinator. + */ + @JsonProperty(value = "coordinatorEnablePublicIpAccess") + private Boolean coordinatorEnablePublicIpAccess; + + /* + * The edition of a node (default: MemoryOptimized). + */ + @JsonProperty(value = "nodeServerEdition") + private String nodeServerEdition; + + /* + * Worker node count of the cluster. When node count is 0, it represents a coordinator with the ability to create + * distributed tables on that node. Node count value can not be 1. + */ + @JsonProperty(value = "nodeCount") + private Long nodeCount; + + /* + * The storage of a node in MB. + */ + @JsonProperty(value = "nodeStorageQuotaInMb") + private Long nodeStorageQuotaInMb; + + /* + * The vCores count of a node (max: 64). + */ + @JsonProperty(value = "nodeVCores") + private Long nodeVCores; + + /* + * If public IP is requested or not for a node. + */ + @JsonProperty(value = "nodeEnablePublicIpAccess", access = JsonProperty.Access.WRITE_ONLY) + private Boolean nodeEnablePublicIpAccess; + + /* + * Maintenance window of a cluster. + */ + @JsonProperty(value = "maintenanceWindow") + private MaintenanceWindow maintenanceWindow; + + /** Creates an instance of ClusterPropertiesForUpdate class. */ + public ClusterPropertiesForUpdate() { + } + + /** + * 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 ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the postgresqlVersion property: The PostgreSQL version of the cluster. + * + * @return the postgresqlVersion value. + */ + public String postgresqlVersion() { + return this.postgresqlVersion; + } + + /** + * Set the postgresqlVersion property: The PostgreSQL version of the cluster. + * + * @param postgresqlVersion the postgresqlVersion value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withPostgresqlVersion(String postgresqlVersion) { + this.postgresqlVersion = postgresqlVersion; + return this; + } + + /** + * Get the citusVersion property: The Citus version of the cluster. + * + * @return the citusVersion value. + */ + public String citusVersion() { + return this.citusVersion; + } + + /** + * Set the citusVersion property: The Citus version of the cluster. + * + * @param citusVersion the citusVersion value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withCitusVersion(String citusVersion) { + this.citusVersion = citusVersion; + return this; + } + + /** + * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * + * @return the enableShardsOnCoordinator value. + */ + public Boolean enableShardsOnCoordinator() { + return this.enableShardsOnCoordinator; + } + + /** + * Set the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * + * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) { + this.enableShardsOnCoordinator = enableShardsOnCoordinator; + return this; + } + + /** + * Get the enableHa property: If high availability is enabled or not for the cluster. + * + * @return the enableHa value. + */ + public Boolean enableHa() { + return this.enableHa; + } + + /** + * Set the enableHa property: If high availability is enabled or not for the cluster. + * + * @param enableHa the enableHa value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withEnableHa(Boolean enableHa) { + this.enableHa = enableHa; + return this; + } + + /** + * Get the preferredPrimaryZone property: Preferred primary zone for the cluster. + * + * @return the preferredPrimaryZone value. + */ + public String preferredPrimaryZone() { + return this.preferredPrimaryZone; + } + + /** + * Set the preferredPrimaryZone property: Preferred primary zone for the cluster. + * + * @param preferredPrimaryZone the preferredPrimaryZone value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withPreferredPrimaryZone(String preferredPrimaryZone) { + this.preferredPrimaryZone = preferredPrimaryZone; + return this; + } + + /** + * Get the coordinatorServerEdition property: The edition of the coordinator (default: GeneralPurpose). + * + * @return the coordinatorServerEdition value. + */ + public String coordinatorServerEdition() { + return this.coordinatorServerEdition; + } + + /** + * Set the coordinatorServerEdition property: The edition of the coordinator (default: GeneralPurpose). + * + * @param coordinatorServerEdition the coordinatorServerEdition value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withCoordinatorServerEdition(String coordinatorServerEdition) { + this.coordinatorServerEdition = coordinatorServerEdition; + return this; + } + + /** + * Get the coordinatorStorageQuotaInMb property: The storage of the coordinator in MB. + * + * @return the coordinatorStorageQuotaInMb value. + */ + public Long coordinatorStorageQuotaInMb() { + return this.coordinatorStorageQuotaInMb; + } + + /** + * Set the coordinatorStorageQuotaInMb property: The storage of the coordinator in MB. + * + * @param coordinatorStorageQuotaInMb the coordinatorStorageQuotaInMb value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withCoordinatorStorageQuotaInMb(Long coordinatorStorageQuotaInMb) { + this.coordinatorStorageQuotaInMb = coordinatorStorageQuotaInMb; + return this; + } + + /** + * Get the coordinatorVCores property: The vCores count of the coordinator (max: 64). + * + * @return the coordinatorVCores value. + */ + public Long coordinatorVCores() { + return this.coordinatorVCores; + } + + /** + * Set the coordinatorVCores property: The vCores count of the coordinator (max: 64). + * + * @param coordinatorVCores the coordinatorVCores value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withCoordinatorVCores(Long coordinatorVCores) { + this.coordinatorVCores = coordinatorVCores; + return this; + } + + /** + * Get the coordinatorEnablePublicIpAccess property: If public IP is requested or not for the coordinator. + * + * @return the coordinatorEnablePublicIpAccess value. + */ + public Boolean coordinatorEnablePublicIpAccess() { + return this.coordinatorEnablePublicIpAccess; + } + + /** + * Set the coordinatorEnablePublicIpAccess property: If public IP is requested or not for the coordinator. + * + * @param coordinatorEnablePublicIpAccess the coordinatorEnablePublicIpAccess value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withCoordinatorEnablePublicIpAccess(Boolean coordinatorEnablePublicIpAccess) { + this.coordinatorEnablePublicIpAccess = coordinatorEnablePublicIpAccess; + return this; + } + + /** + * Get the nodeServerEdition property: The edition of a node (default: MemoryOptimized). + * + * @return the nodeServerEdition value. + */ + public String nodeServerEdition() { + return this.nodeServerEdition; + } + + /** + * Set the nodeServerEdition property: The edition of a node (default: MemoryOptimized). + * + * @param nodeServerEdition the nodeServerEdition value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withNodeServerEdition(String nodeServerEdition) { + this.nodeServerEdition = nodeServerEdition; + return this; + } + + /** + * Get the nodeCount property: Worker node count of the cluster. When node count is 0, it represents a coordinator + * with the ability to create distributed tables on that node. Node count value can not be 1. + * + * @return the nodeCount value. + */ + public Long nodeCount() { + return this.nodeCount; + } + + /** + * Set the nodeCount property: Worker node count of the cluster. When node count is 0, it represents a coordinator + * with the ability to create distributed tables on that node. Node count value can not be 1. + * + * @param nodeCount the nodeCount value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withNodeCount(Long nodeCount) { + this.nodeCount = nodeCount; + return this; + } + + /** + * Get the nodeStorageQuotaInMb property: The storage of a node in MB. + * + * @return the nodeStorageQuotaInMb value. + */ + public Long nodeStorageQuotaInMb() { + return this.nodeStorageQuotaInMb; + } + + /** + * Set the nodeStorageQuotaInMb property: The storage of a node in MB. + * + * @param nodeStorageQuotaInMb the nodeStorageQuotaInMb value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withNodeStorageQuotaInMb(Long nodeStorageQuotaInMb) { + this.nodeStorageQuotaInMb = nodeStorageQuotaInMb; + return this; + } + + /** + * Get the nodeVCores property: The vCores count of a node (max: 64). + * + * @return the nodeVCores value. + */ + public Long nodeVCores() { + return this.nodeVCores; + } + + /** + * Set the nodeVCores property: The vCores count of a node (max: 64). + * + * @param nodeVCores the nodeVCores value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withNodeVCores(Long nodeVCores) { + this.nodeVCores = nodeVCores; + return this; + } + + /** + * Get the nodeEnablePublicIpAccess property: If public IP is requested or not for a node. + * + * @return the nodeEnablePublicIpAccess value. + */ + public Boolean nodeEnablePublicIpAccess() { + return this.nodeEnablePublicIpAccess; + } + + /** + * Get the maintenanceWindow property: Maintenance window of a cluster. + * + * @return the maintenanceWindow value. + */ + public MaintenanceWindow maintenanceWindow() { + return this.maintenanceWindow; + } + + /** + * Set the maintenanceWindow property: Maintenance window of a cluster. + * + * @param maintenanceWindow the maintenanceWindow value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + this.maintenanceWindow = maintenanceWindow; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (maintenanceWindow() != null) { + maintenanceWindow().validate(); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterResponseInner.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterResponseInner.java new file mode 100644 index 0000000000000..f48496f95d555 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterResponseInner.java @@ -0,0 +1,505 @@ +// 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.resourcemanager.postgresqlhsc.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnection; +import com.azure.resourcemanager.postgresqlhsc.models.ServerNameItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Represents a cluster in response body. */ +@Fluent +public final class ClusterResponseInner extends Resource { + /* + * Properties of the cluster response body. + */ + @JsonProperty(value = "properties") + private ClusterResponseProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of ClusterResponseInner class. */ + public ClusterResponseInner() { + } + + /** + * Get the innerProperties property: Properties of the cluster response body. + * + * @return the innerProperties value. + */ + private ClusterResponseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public ClusterResponseInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ClusterResponseInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the administratorLogin property: The administrator's login name of the servers in the cluster. + * + * @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 the servers in the cluster. + * + * @param administratorLogin the administratorLogin value to set. + * @return the ClusterResponseInner object itself. + */ + public ClusterResponseInner withAdministratorLogin(String administratorLogin) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterResponseProperties(); + } + this.innerProperties().withAdministratorLogin(administratorLogin); + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the cluster. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the state property: A state of a cluster/server that is visible to user. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the postgresqlVersion property: The PostgreSQL version of cluster. + * + * @return the postgresqlVersion value. + */ + public String postgresqlVersion() { + return this.innerProperties() == null ? null : this.innerProperties().postgresqlVersion(); + } + + /** + * Set the postgresqlVersion property: The PostgreSQL version of cluster. + * + * @param postgresqlVersion the postgresqlVersion value to set. + * @return the ClusterResponseInner object itself. + */ + public ClusterResponseInner withPostgresqlVersion(String postgresqlVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterResponseProperties(); + } + this.innerProperties().withPostgresqlVersion(postgresqlVersion); + return this; + } + + /** + * Get the citusVersion property: The Citus version of cluster. + * + * @return the citusVersion value. + */ + public String citusVersion() { + return this.innerProperties() == null ? null : this.innerProperties().citusVersion(); + } + + /** + * Set the citusVersion property: The Citus version of cluster. + * + * @param citusVersion the citusVersion value to set. + * @return the ClusterResponseInner object itself. + */ + public ClusterResponseInner withCitusVersion(String citusVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterResponseProperties(); + } + this.innerProperties().withCitusVersion(citusVersion); + return this; + } + + /** + * Get the maintenanceWindow property: Maintenance window of a cluster. + * + * @return the maintenanceWindow value. + */ + public MaintenanceWindow maintenanceWindow() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceWindow(); + } + + /** + * Set the maintenanceWindow property: Maintenance window of a cluster. + * + * @param maintenanceWindow the maintenanceWindow value to set. + * @return the ClusterResponseInner object itself. + */ + public ClusterResponseInner withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterResponseProperties(); + } + this.innerProperties().withMaintenanceWindow(maintenanceWindow); + return this; + } + + /** + * Get the preferredPrimaryZone property: Preferred primary zone for the cluster. + * + * @return the preferredPrimaryZone value. + */ + public String preferredPrimaryZone() { + return this.innerProperties() == null ? null : this.innerProperties().preferredPrimaryZone(); + } + + /** + * Set the preferredPrimaryZone property: Preferred primary zone for the cluster. + * + * @param preferredPrimaryZone the preferredPrimaryZone value to set. + * @return the ClusterResponseInner object itself. + */ + public ClusterResponseInner withPreferredPrimaryZone(String preferredPrimaryZone) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterResponseProperties(); + } + this.innerProperties().withPreferredPrimaryZone(preferredPrimaryZone); + return this; + } + + /** + * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * + * @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 cluster. + * + * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. + * @return the ClusterResponseInner object itself. + */ + public ClusterResponseInner withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterResponseProperties(); + } + this.innerProperties().withEnableShardsOnCoordinator(enableShardsOnCoordinator); + 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 ClusterResponseInner object itself. + */ + public ClusterResponseInner withEnableHa(Boolean enableHa) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterResponseProperties(); + } + this.innerProperties().withEnableHa(enableHa); + return this; + } + + /** + * Get the coordinatorServerEdition property: The edition of a coordinator server (default: GeneralPurpose). + * + * @return the coordinatorServerEdition value. + */ + public String coordinatorServerEdition() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorServerEdition(); + } + + /** + * Set the coordinatorServerEdition property: The edition of a coordinator server (default: GeneralPurpose). + * + * @param coordinatorServerEdition the coordinatorServerEdition value to set. + * @return the ClusterResponseInner object itself. + */ + public ClusterResponseInner withCoordinatorServerEdition(String coordinatorServerEdition) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterResponseProperties(); + } + this.innerProperties().withCoordinatorServerEdition(coordinatorServerEdition); + return this; + } + + /** + * Get the coordinatorStorageQuotaInMb property: The storage of a server in MB. + * + * @return the coordinatorStorageQuotaInMb value. + */ + public Long coordinatorStorageQuotaInMb() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorStorageQuotaInMb(); + } + + /** + * Set the coordinatorStorageQuotaInMb property: The storage of a server in MB. + * + * @param coordinatorStorageQuotaInMb the coordinatorStorageQuotaInMb value to set. + * @return the ClusterResponseInner object itself. + */ + public ClusterResponseInner withCoordinatorStorageQuotaInMb(Long coordinatorStorageQuotaInMb) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterResponseProperties(); + } + this.innerProperties().withCoordinatorStorageQuotaInMb(coordinatorStorageQuotaInMb); + return this; + } + + /** + * Get the coordinatorVCores property: The vCores count of a server (max: 64). + * + * @return the coordinatorVCores value. + */ + public Long coordinatorVCores() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorVCores(); + } + + /** + * Set the coordinatorVCores property: The vCores count of a server (max: 64). + * + * @param coordinatorVCores the coordinatorVCores value to set. + * @return the ClusterResponseInner object itself. + */ + public ClusterResponseInner withCoordinatorVCores(Long coordinatorVCores) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterResponseProperties(); + } + this.innerProperties().withCoordinatorVCores(coordinatorVCores); + return this; + } + + /** + * Get the coordinatorEnablePublicIpAccess property: If public IP is requested or not for a server. + * + * @return the coordinatorEnablePublicIpAccess value. + */ + public Boolean coordinatorEnablePublicIpAccess() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorEnablePublicIpAccess(); + } + + /** + * Set the coordinatorEnablePublicIpAccess property: If public IP is requested or not for a server. + * + * @param coordinatorEnablePublicIpAccess the coordinatorEnablePublicIpAccess value to set. + * @return the ClusterResponseInner object itself. + */ + public ClusterResponseInner withCoordinatorEnablePublicIpAccess(Boolean coordinatorEnablePublicIpAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterResponseProperties(); + } + this.innerProperties().withCoordinatorEnablePublicIpAccess(coordinatorEnablePublicIpAccess); + return this; + } + + /** + * Get the nodeServerEdition property: The edition of a node server (default: MemoryOptimized). + * + * @return the nodeServerEdition value. + */ + public String nodeServerEdition() { + return this.innerProperties() == null ? null : this.innerProperties().nodeServerEdition(); + } + + /** + * Set the nodeServerEdition property: The edition of a node server (default: MemoryOptimized). + * + * @param nodeServerEdition the nodeServerEdition value to set. + * @return the ClusterResponseInner object itself. + */ + public ClusterResponseInner withNodeServerEdition(String nodeServerEdition) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterResponseProperties(); + } + this.innerProperties().withNodeServerEdition(nodeServerEdition); + return this; + } + + /** + * Get the nodeCount property: Worker node count of the cluster. + * + * @return the nodeCount value. + */ + public Long nodeCount() { + return this.innerProperties() == null ? null : this.innerProperties().nodeCount(); + } + + /** + * Set the nodeCount property: Worker node count of the cluster. + * + * @param nodeCount the nodeCount value to set. + * @return the ClusterResponseInner object itself. + */ + public ClusterResponseInner withNodeCount(Long nodeCount) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterResponseProperties(); + } + this.innerProperties().withNodeCount(nodeCount); + return this; + } + + /** + * Get the nodeStorageQuotaInMb property: The storage of a server in MB. + * + * @return the nodeStorageQuotaInMb value. + */ + public Long nodeStorageQuotaInMb() { + return this.innerProperties() == null ? null : this.innerProperties().nodeStorageQuotaInMb(); + } + + /** + * Set the nodeStorageQuotaInMb property: The storage of a server in MB. + * + * @param nodeStorageQuotaInMb the nodeStorageQuotaInMb value to set. + * @return the ClusterResponseInner object itself. + */ + public ClusterResponseInner withNodeStorageQuotaInMb(Long nodeStorageQuotaInMb) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterResponseProperties(); + } + this.innerProperties().withNodeStorageQuotaInMb(nodeStorageQuotaInMb); + return this; + } + + /** + * Get the nodeVCores property: The vCores count of a server (max: 64). + * + * @return the nodeVCores value. + */ + public Long nodeVCores() { + return this.innerProperties() == null ? null : this.innerProperties().nodeVCores(); + } + + /** + * Set the nodeVCores property: The vCores count of a server (max: 64). + * + * @param nodeVCores the nodeVCores value to set. + * @return the ClusterResponseInner object itself. + */ + public ClusterResponseInner withNodeVCores(Long nodeVCores) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterResponseProperties(); + } + this.innerProperties().withNodeVCores(nodeVCores); + return this; + } + + /** + * Get the nodeEnablePublicIpAccess property: If public IP is requested or not for a server. + * + * @return the nodeEnablePublicIpAccess value. + */ + public Boolean nodeEnablePublicIpAccess() { + return this.innerProperties() == null ? null : this.innerProperties().nodeEnablePublicIpAccess(); + } + + /** + * Get the serverNames property: The list of server names in the cluster. + * + * @return the serverNames value. + */ + public List serverNames() { + return this.innerProperties() == null ? null : this.innerProperties().serverNames(); + } + + /** + * Get the sourceResourceId property: The resource id of source cluster for read replica clusters. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceResourceId(); + } + + /** + * Get the sourceLocation property: The location of source cluster for read replica clusters. + * + * @return the sourceLocation value. + */ + public String sourceLocation() { + return this.innerProperties() == null ? null : this.innerProperties().sourceLocation(); + } + + /** + * Get the readReplicas property: The array of read replica clusters. + * + * @return the readReplicas value. + */ + public List readReplicas() { + return this.innerProperties() == null ? null : this.innerProperties().readReplicas(); + } + + /** + * Get the earliestRestoreTime property: The earliest restore point time (ISO8601 format) for the cluster. + * + * @return the earliestRestoreTime value. + */ + public OffsetDateTime earliestRestoreTime() { + return this.innerProperties() == null ? null : this.innerProperties().earliestRestoreTime(); + } + + /** + * Get the privateEndpointConnections property: The private endpoint connections for a cluster. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); + } + + /** + * 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/ClusterResponseProperties.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterResponseProperties.java new file mode 100644 index 0000000000000..e2ffd9e5bdf0e --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterResponseProperties.java @@ -0,0 +1,563 @@ +// 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.resourcemanager.postgresqlhsc.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnection; +import com.azure.resourcemanager.postgresqlhsc.models.ServerNameItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of the cluster response body. */ +@Fluent +public final class ClusterResponseProperties { + /* + * The administrator's login name of the servers in the cluster. + */ + @JsonProperty(value = "administratorLogin") + private String administratorLogin; + + /* + * Provisioning state of the cluster + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * A state of a cluster/server that is visible to user. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The PostgreSQL version of cluster. + */ + @JsonProperty(value = "postgresqlVersion") + private String postgresqlVersion; + + /* + * The Citus version of cluster. + */ + @JsonProperty(value = "citusVersion") + private String citusVersion; + + /* + * Maintenance window of a cluster. + */ + @JsonProperty(value = "maintenanceWindow") + private MaintenanceWindow maintenanceWindow; + + /* + * Preferred primary zone for the cluster + */ + @JsonProperty(value = "preferredPrimaryZone") + private String preferredPrimaryZone; + + /* + * If shards on coordinator is enabled or not for the cluster. + */ + @JsonProperty(value = "enableShardsOnCoordinator") + private Boolean enableShardsOnCoordinator; + + /* + * If high availability is enabled or not for the server. + */ + @JsonProperty(value = "enableHa") + private Boolean enableHa; + + /* + * The edition of a coordinator server (default: GeneralPurpose). + */ + @JsonProperty(value = "coordinatorServerEdition") + private String coordinatorServerEdition; + + /* + * The storage of a server in MB. + */ + @JsonProperty(value = "coordinatorStorageQuotaInMb") + private Long coordinatorStorageQuotaInMb; + + /* + * The vCores count of a server (max: 64). + */ + @JsonProperty(value = "coordinatorVCores") + private Long coordinatorVCores; + + /* + * If public IP is requested or not for a server. + */ + @JsonProperty(value = "coordinatorEnablePublicIpAccess") + private Boolean coordinatorEnablePublicIpAccess; + + /* + * The edition of a node server (default: MemoryOptimized). + */ + @JsonProperty(value = "nodeServerEdition") + private String nodeServerEdition; + + /* + * Worker node count of the cluster + */ + @JsonProperty(value = "nodeCount") + private Long nodeCount; + + /* + * The storage of a server in MB. + */ + @JsonProperty(value = "nodeStorageQuotaInMb") + private Long nodeStorageQuotaInMb; + + /* + * The vCores count of a server (max: 64). + */ + @JsonProperty(value = "nodeVCores") + private Long nodeVCores; + + /* + * If public IP is requested or not for a server. + */ + @JsonProperty(value = "nodeEnablePublicIpAccess", access = JsonProperty.Access.WRITE_ONLY) + private Boolean nodeEnablePublicIpAccess; + + /* + * The list of server names in the cluster + */ + @JsonProperty(value = "serverNames", access = JsonProperty.Access.WRITE_ONLY) + private List serverNames; + + /* + * The resource id of source cluster for read replica clusters. + */ + @JsonProperty(value = "sourceResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String sourceResourceId; + + /* + * The location of source cluster for read replica clusters. + */ + @JsonProperty(value = "sourceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String sourceLocation; + + /* + * The array of read replica clusters. + */ + @JsonProperty(value = "readReplicas", access = JsonProperty.Access.WRITE_ONLY) + private List readReplicas; + + /* + * The earliest restore point time (ISO8601 format) for the cluster. + */ + @JsonProperty(value = "earliestRestoreTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime earliestRestoreTime; + + /* + * The private endpoint connections for a cluster. + */ + @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /** Creates an instance of ClusterResponseProperties class. */ + public ClusterResponseProperties() { + } + + /** + * Get the administratorLogin property: The administrator's login name of the servers in the cluster. + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: The administrator's login name of the servers in the cluster. + * + * @param administratorLogin the administratorLogin value to set. + * @return the ClusterResponseProperties object itself. + */ + public ClusterResponseProperties withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the cluster. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the state property: A state of a cluster/server that is visible to user. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the postgresqlVersion property: The PostgreSQL version of cluster. + * + * @return the postgresqlVersion value. + */ + public String postgresqlVersion() { + return this.postgresqlVersion; + } + + /** + * Set the postgresqlVersion property: The PostgreSQL version of cluster. + * + * @param postgresqlVersion the postgresqlVersion value to set. + * @return the ClusterResponseProperties object itself. + */ + public ClusterResponseProperties withPostgresqlVersion(String postgresqlVersion) { + this.postgresqlVersion = postgresqlVersion; + return this; + } + + /** + * Get the citusVersion property: The Citus version of cluster. + * + * @return the citusVersion value. + */ + public String citusVersion() { + return this.citusVersion; + } + + /** + * Set the citusVersion property: The Citus version of cluster. + * + * @param citusVersion the citusVersion value to set. + * @return the ClusterResponseProperties object itself. + */ + public ClusterResponseProperties withCitusVersion(String citusVersion) { + this.citusVersion = citusVersion; + return this; + } + + /** + * Get the maintenanceWindow property: Maintenance window of a cluster. + * + * @return the maintenanceWindow value. + */ + public MaintenanceWindow maintenanceWindow() { + return this.maintenanceWindow; + } + + /** + * Set the maintenanceWindow property: Maintenance window of a cluster. + * + * @param maintenanceWindow the maintenanceWindow value to set. + * @return the ClusterResponseProperties object itself. + */ + public ClusterResponseProperties withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + this.maintenanceWindow = maintenanceWindow; + return this; + } + + /** + * Get the preferredPrimaryZone property: Preferred primary zone for the cluster. + * + * @return the preferredPrimaryZone value. + */ + public String preferredPrimaryZone() { + return this.preferredPrimaryZone; + } + + /** + * Set the preferredPrimaryZone property: Preferred primary zone for the cluster. + * + * @param preferredPrimaryZone the preferredPrimaryZone value to set. + * @return the ClusterResponseProperties object itself. + */ + public ClusterResponseProperties withPreferredPrimaryZone(String preferredPrimaryZone) { + this.preferredPrimaryZone = preferredPrimaryZone; + return this; + } + + /** + * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * + * @return the enableShardsOnCoordinator value. + */ + public Boolean enableShardsOnCoordinator() { + return this.enableShardsOnCoordinator; + } + + /** + * Set the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * + * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. + * @return the ClusterResponseProperties object itself. + */ + public ClusterResponseProperties withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) { + this.enableShardsOnCoordinator = enableShardsOnCoordinator; + 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 ClusterResponseProperties object itself. + */ + public ClusterResponseProperties withEnableHa(Boolean enableHa) { + this.enableHa = enableHa; + return this; + } + + /** + * Get the coordinatorServerEdition property: The edition of a coordinator server (default: GeneralPurpose). + * + * @return the coordinatorServerEdition value. + */ + public String coordinatorServerEdition() { + return this.coordinatorServerEdition; + } + + /** + * Set the coordinatorServerEdition property: The edition of a coordinator server (default: GeneralPurpose). + * + * @param coordinatorServerEdition the coordinatorServerEdition value to set. + * @return the ClusterResponseProperties object itself. + */ + public ClusterResponseProperties withCoordinatorServerEdition(String coordinatorServerEdition) { + this.coordinatorServerEdition = coordinatorServerEdition; + return this; + } + + /** + * Get the coordinatorStorageQuotaInMb property: The storage of a server in MB. + * + * @return the coordinatorStorageQuotaInMb value. + */ + public Long coordinatorStorageQuotaInMb() { + return this.coordinatorStorageQuotaInMb; + } + + /** + * Set the coordinatorStorageQuotaInMb property: The storage of a server in MB. + * + * @param coordinatorStorageQuotaInMb the coordinatorStorageQuotaInMb value to set. + * @return the ClusterResponseProperties object itself. + */ + public ClusterResponseProperties withCoordinatorStorageQuotaInMb(Long coordinatorStorageQuotaInMb) { + this.coordinatorStorageQuotaInMb = coordinatorStorageQuotaInMb; + return this; + } + + /** + * Get the coordinatorVCores property: The vCores count of a server (max: 64). + * + * @return the coordinatorVCores value. + */ + public Long coordinatorVCores() { + return this.coordinatorVCores; + } + + /** + * Set the coordinatorVCores property: The vCores count of a server (max: 64). + * + * @param coordinatorVCores the coordinatorVCores value to set. + * @return the ClusterResponseProperties object itself. + */ + public ClusterResponseProperties withCoordinatorVCores(Long coordinatorVCores) { + this.coordinatorVCores = coordinatorVCores; + return this; + } + + /** + * Get the coordinatorEnablePublicIpAccess property: If public IP is requested or not for a server. + * + * @return the coordinatorEnablePublicIpAccess value. + */ + public Boolean coordinatorEnablePublicIpAccess() { + return this.coordinatorEnablePublicIpAccess; + } + + /** + * Set the coordinatorEnablePublicIpAccess property: If public IP is requested or not for a server. + * + * @param coordinatorEnablePublicIpAccess the coordinatorEnablePublicIpAccess value to set. + * @return the ClusterResponseProperties object itself. + */ + public ClusterResponseProperties withCoordinatorEnablePublicIpAccess(Boolean coordinatorEnablePublicIpAccess) { + this.coordinatorEnablePublicIpAccess = coordinatorEnablePublicIpAccess; + return this; + } + + /** + * Get the nodeServerEdition property: The edition of a node server (default: MemoryOptimized). + * + * @return the nodeServerEdition value. + */ + public String nodeServerEdition() { + return this.nodeServerEdition; + } + + /** + * Set the nodeServerEdition property: The edition of a node server (default: MemoryOptimized). + * + * @param nodeServerEdition the nodeServerEdition value to set. + * @return the ClusterResponseProperties object itself. + */ + public ClusterResponseProperties withNodeServerEdition(String nodeServerEdition) { + this.nodeServerEdition = nodeServerEdition; + return this; + } + + /** + * Get the nodeCount property: Worker node count of the cluster. + * + * @return the nodeCount value. + */ + public Long nodeCount() { + return this.nodeCount; + } + + /** + * Set the nodeCount property: Worker node count of the cluster. + * + * @param nodeCount the nodeCount value to set. + * @return the ClusterResponseProperties object itself. + */ + public ClusterResponseProperties withNodeCount(Long nodeCount) { + this.nodeCount = nodeCount; + return this; + } + + /** + * Get the nodeStorageQuotaInMb property: The storage of a server in MB. + * + * @return the nodeStorageQuotaInMb value. + */ + public Long nodeStorageQuotaInMb() { + return this.nodeStorageQuotaInMb; + } + + /** + * Set the nodeStorageQuotaInMb property: The storage of a server in MB. + * + * @param nodeStorageQuotaInMb the nodeStorageQuotaInMb value to set. + * @return the ClusterResponseProperties object itself. + */ + public ClusterResponseProperties withNodeStorageQuotaInMb(Long nodeStorageQuotaInMb) { + this.nodeStorageQuotaInMb = nodeStorageQuotaInMb; + return this; + } + + /** + * Get the nodeVCores property: The vCores count of a server (max: 64). + * + * @return the nodeVCores value. + */ + public Long nodeVCores() { + return this.nodeVCores; + } + + /** + * Set the nodeVCores property: The vCores count of a server (max: 64). + * + * @param nodeVCores the nodeVCores value to set. + * @return the ClusterResponseProperties object itself. + */ + public ClusterResponseProperties withNodeVCores(Long nodeVCores) { + this.nodeVCores = nodeVCores; + return this; + } + + /** + * Get the nodeEnablePublicIpAccess property: If public IP is requested or not for a server. + * + * @return the nodeEnablePublicIpAccess value. + */ + public Boolean nodeEnablePublicIpAccess() { + return this.nodeEnablePublicIpAccess; + } + + /** + * Get the serverNames property: The list of server names in the cluster. + * + * @return the serverNames value. + */ + public List serverNames() { + return this.serverNames; + } + + /** + * Get the sourceResourceId property: The resource id of source cluster for read replica clusters. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.sourceResourceId; + } + + /** + * Get the sourceLocation property: The location of source cluster for read replica clusters. + * + * @return the sourceLocation value. + */ + public String sourceLocation() { + return this.sourceLocation; + } + + /** + * Get the readReplicas property: The array of read replica clusters. + * + * @return the readReplicas value. + */ + public List readReplicas() { + return this.readReplicas; + } + + /** + * Get the earliestRestoreTime property: The earliest restore point time (ISO8601 format) for the cluster. + * + * @return the earliestRestoreTime value. + */ + public OffsetDateTime earliestRestoreTime() { + return this.earliestRestoreTime; + } + + /** + * Get the privateEndpointConnections property: The private endpoint connections for a cluster. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (maintenanceWindow() != null) { + maintenanceWindow().validate(); + } + if (serverNames() != null) { + serverNames().forEach(e -> e.validate()); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterServerInner.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterServerInner.java new file mode 100644 index 0000000000000..c9e118728d233 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterServerInner.java @@ -0,0 +1,280 @@ +// 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.resourcemanager.postgresqlhsc.models.ServerRole; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a server in a cluster. */ +@Fluent +public final class ClusterServerInner extends ProxyResource { + /* + * The properties of a server in a cluster. + */ + @JsonProperty(value = "properties") + private ClusterServerProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of ClusterServerInner class. */ + public ClusterServerInner() { + } + + /** + * Get the innerProperties property: The properties of a server in a cluster. + * + * @return the innerProperties value. + */ + private ClusterServerProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the 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 cluster. + * + * @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 cluster. + * + * @param role the role value to set. + * @return the ClusterServerInner object itself. + */ + public ClusterServerInner withRole(ServerRole role) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterServerProperties(); + } + this.innerProperties().withRole(role); + return this; + } + + /** + * Get the state property: A state of a cluster/server that is visible to user. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the haState property: A state of HA feature for the cluster. + * + * @return the haState value. + */ + public String haState() { + return this.innerProperties() == null ? null : this.innerProperties().haState(); + } + + /** + * Get the availabilityZone property: Availability Zone information of the server. + * + * @return the availabilityZone value. + */ + public String availabilityZone() { + return this.innerProperties() == null ? null : this.innerProperties().availabilityZone(); + } + + /** + * Set the availabilityZone property: Availability Zone information of the server. + * + * @param availabilityZone the availabilityZone value to set. + * @return the ClusterServerInner object itself. + */ + public ClusterServerInner withAvailabilityZone(String availabilityZone) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterServerProperties(); + } + this.innerProperties().withAvailabilityZone(availabilityZone); + return this; + } + + /** + * Get the postgresqlVersion property: The PostgreSQL version of server. + * + * @return the postgresqlVersion value. + */ + public String 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 ClusterServerInner object itself. + */ + public ClusterServerInner withPostgresqlVersion(String postgresqlVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterServerProperties(); + } + this.innerProperties().withPostgresqlVersion(postgresqlVersion); + return this; + } + + /** + * Get the citusVersion property: The Citus version of server. + * + * @return the citusVersion value. + */ + public String 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 ClusterServerInner object itself. + */ + public ClusterServerInner withCitusVersion(String citusVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterServerProperties(); + } + this.innerProperties().withCitusVersion(citusVersion); + return this; + } + + /** + * Get the serverEdition property: The edition of a server. + * + * @return the serverEdition value. + */ + public String serverEdition() { + return this.innerProperties() == null ? null : this.innerProperties().serverEdition(); + } + + /** + * Set the serverEdition property: The edition of a server. + * + * @param serverEdition the serverEdition value to set. + * @return the ClusterServerInner object itself. + */ + public ClusterServerInner withServerEdition(String serverEdition) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterServerProperties(); + } + this.innerProperties().withServerEdition(serverEdition); + return this; + } + + /** + * Get the storageQuotaInMb property: The storage of a server in MB. + * + * @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. + * + * @param storageQuotaInMb the storageQuotaInMb value to set. + * @return the ClusterServerInner object itself. + */ + public ClusterServerInner withStorageQuotaInMb(Long storageQuotaInMb) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterServerProperties(); + } + 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 ClusterServerInner object itself. + */ + public ClusterServerInner withVCores(Long vCores) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterServerProperties(); + } + 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 ClusterServerInner object itself. + */ + public ClusterServerInner withEnableHa(Boolean enableHa) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterServerProperties(); + } + 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/ClusterServerProperties.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterServerProperties.java new file mode 100644 index 0000000000000..11b010b05ccd6 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterServerProperties.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlhsc.models.ServerProperties; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRole; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a server in cluster. */ +@Fluent +public final class ClusterServerProperties extends ServerProperties { + /* + * 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 cluster. + */ + @JsonProperty(value = "role") + private ServerRole role; + + /* + * A state of a cluster/server that is visible to user. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * A state of HA feature for the cluster. + */ + @JsonProperty(value = "haState", access = JsonProperty.Access.WRITE_ONLY) + private String haState; + + /* + * Availability Zone information of the server. + */ + @JsonProperty(value = "availabilityZone") + private String availabilityZone; + + /* + * The PostgreSQL version of server. + */ + @JsonProperty(value = "postgresqlVersion") + private String postgresqlVersion; + + /* + * The Citus version of server. + */ + @JsonProperty(value = "citusVersion") + private String citusVersion; + + /** Creates an instance of ClusterServerProperties class. */ + public ClusterServerProperties() { + } + + /** + * 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 cluster. + * + * @return the role value. + */ + public ServerRole role() { + return this.role; + } + + /** + * Set the role property: The role of server in the cluster. + * + * @param role the role value to set. + * @return the ClusterServerProperties object itself. + */ + public ClusterServerProperties withRole(ServerRole role) { + this.role = role; + return this; + } + + /** + * Get the state property: A state of a cluster/server that is visible to user. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the haState property: A state of HA feature for the cluster. + * + * @return the haState value. + */ + public String haState() { + return this.haState; + } + + /** + * Get the availabilityZone property: Availability Zone information of the server. + * + * @return the availabilityZone value. + */ + public String availabilityZone() { + return this.availabilityZone; + } + + /** + * Set the availabilityZone property: Availability Zone information of the server. + * + * @param availabilityZone the availabilityZone value to set. + * @return the ClusterServerProperties object itself. + */ + public ClusterServerProperties withAvailabilityZone(String availabilityZone) { + this.availabilityZone = availabilityZone; + return this; + } + + /** + * Get the postgresqlVersion property: The PostgreSQL version of server. + * + * @return the postgresqlVersion value. + */ + public String postgresqlVersion() { + return this.postgresqlVersion; + } + + /** + * Set the postgresqlVersion property: The PostgreSQL version of server. + * + * @param postgresqlVersion the postgresqlVersion value to set. + * @return the ClusterServerProperties object itself. + */ + public ClusterServerProperties withPostgresqlVersion(String postgresqlVersion) { + this.postgresqlVersion = postgresqlVersion; + return this; + } + + /** + * Get the citusVersion property: The Citus version of server. + * + * @return the citusVersion value. + */ + public String citusVersion() { + return this.citusVersion; + } + + /** + * Set the citusVersion property: The Citus version of server. + * + * @param citusVersion the citusVersion value to set. + * @return the ClusterServerProperties object itself. + */ + public ClusterServerProperties withCitusVersion(String citusVersion) { + this.citusVersion = citusVersion; + return this; + } + + /** {@inheritDoc} */ + @Override + public ClusterServerProperties withServerEdition(String serverEdition) { + super.withServerEdition(serverEdition); + return this; + } + + /** {@inheritDoc} */ + @Override + public ClusterServerProperties withStorageQuotaInMb(Long storageQuotaInMb) { + super.withStorageQuotaInMb(storageQuotaInMb); + return this; + } + + /** {@inheritDoc} */ + @Override + public ClusterServerProperties withVCores(Long vCores) { + super.withVCores(vCores); + return this; + } + + /** {@inheritDoc} */ + @Override + public ClusterServerProperties 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/ConfigurationInner.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ConfigurationInner.java new file mode 100644 index 0000000000000..1b4decb898b4f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ConfigurationInner.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.models.ConfigurationDataType; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRoleGroupConfiguration; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents configuration details for coordinator and node. */ +@Fluent +public final class ConfigurationInner extends ProxyResource { + /* + * The properties of configuration. + */ + @JsonProperty(value = "properties") + private ConfigurationProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of ConfigurationInner class. */ + public ConfigurationInner() { + } + + /** + * Get the innerProperties property: The properties of configuration. + * + * @return the innerProperties value. + */ + private ConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the 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 requiresRestart property: If configuration change requires restart. + * + * @return the requiresRestart value. + */ + public Boolean requiresRestart() { + return this.innerProperties() == null ? null : this.innerProperties().requiresRestart(); + } + + /** + * Set the requiresRestart property: If configuration change requires restart. + * + * @param requiresRestart the requiresRestart value to set. + * @return the ConfigurationInner object itself. + */ + public ConfigurationInner withRequiresRestart(Boolean requiresRestart) { + if (this.innerProperties() == null) { + this.innerProperties = new ConfigurationProperties(); + } + this.innerProperties().withRequiresRestart(requiresRestart); + return this; + } + + /** + * 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 ConfigurationInner object itself. + */ + public ConfigurationInner withServerRoleGroupConfigurations( + List serverRoleGroupConfigurations) { + if (this.innerProperties() == null) { + this.innerProperties = new ConfigurationProperties(); + } + 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/ConfigurationProperties.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ConfigurationProperties.java new file mode 100644 index 0000000000000..b49f16657679f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ConfigurationProperties.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.JsonProperty; +import java.util.List; + +/** The properties of configuration. */ +@Fluent +public final class ConfigurationProperties { + /* + * 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; + + /* + * If configuration change requires restart. + */ + @JsonProperty(value = "requiresRestart") + private Boolean requiresRestart; + + /* + * The list of server role group configuration values. + */ + @JsonProperty(value = "serverRoleGroupConfigurations", required = true) + private List serverRoleGroupConfigurations; + + /** Creates an instance of ConfigurationProperties class. */ + public ConfigurationProperties() { + } + + /** + * 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 requiresRestart property: If configuration change requires restart. + * + * @return the requiresRestart value. + */ + public Boolean requiresRestart() { + return this.requiresRestart; + } + + /** + * Set the requiresRestart property: If configuration change requires restart. + * + * @param requiresRestart the requiresRestart value to set. + * @return the ConfigurationProperties object itself. + */ + public ConfigurationProperties withRequiresRestart(Boolean requiresRestart) { + this.requiresRestart = requiresRestart; + return this; + } + + /** + * 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 ConfigurationProperties object itself. + */ + public ConfigurationProperties 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 ConfigurationProperties")); + } else { + serverRoleGroupConfigurations().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ConfigurationProperties.class); +} 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..87b49cda67b69 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/FirewallRuleInner.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.JsonProperty; + +/** Represents a cluster firewall rule. */ +@Fluent +public final class FirewallRuleInner extends ProxyResource { + /* + * The properties of a firewall rule. + */ + @JsonProperty(value = "properties", required = true) + private FirewallRuleProperties innerProperties = new FirewallRuleProperties(); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of FirewallRuleInner class. */ + public FirewallRuleInner() { + } + + /** + * Get the innerProperties property: The properties of a firewall rule. + * + * @return the innerProperties value. + */ + private FirewallRuleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the startIpAddress property: The start IP address of the cluster 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 cluster 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 cluster 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 cluster firewall rule. Must be IPv4 format. + * + * @param endIpAddress the endIpAddress value to set. + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withEndIpAddress(String endIpAddress) { + if (this.innerProperties() == null) { + this.innerProperties = new FirewallRuleProperties(); + } + this.innerProperties().withEndIpAddress(endIpAddress); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model FirewallRuleInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FirewallRuleInner.class); +} diff --git a/sdk/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..051c3a86b0f66 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/FirewallRuleProperties.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a cluster firewall rule. */ +@Fluent +public final class FirewallRuleProperties { + /* + * The start IP address of the cluster firewall rule. Must be IPv4 format. + */ + @JsonProperty(value = "startIpAddress", required = true) + private String startIpAddress; + + /* + * The end IP address of the cluster firewall rule. Must be IPv4 format. + */ + @JsonProperty(value = "endIpAddress", required = true) + private String endIpAddress; + + /** Creates an instance of FirewallRuleProperties class. */ + public FirewallRuleProperties() { + } + + /** + * Get the startIpAddress property: The start IP address of the cluster 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 cluster 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 cluster 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 cluster firewall rule. Must be IPv4 format. + * + * @param endIpAddress the endIpAddress value to set. + * @return the FirewallRuleProperties object itself. + */ + public FirewallRuleProperties withEndIpAddress(String endIpAddress) { + this.endIpAddress = endIpAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (startIpAddress() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property startIpAddress in model FirewallRuleProperties")); + } + if (endIpAddress() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property endIpAddress in model FirewallRuleProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FirewallRuleProperties.class); +} diff --git a/sdk/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..29f4d3af15e55 --- /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.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a resource name availability. */ +@Fluent +public final class NameAvailabilityInner { + /* + * Error Message. + */ + @JsonProperty(value = "message") + private String message; + + /* + * Indicates whether the resource name is available. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * name of the cluster. + */ + @JsonProperty(value = "name") + private String name; + + /* + * type of the cluster + */ + @JsonProperty(value = "type") + private String type; + + /** Creates an instance of NameAvailabilityInner class. */ + public NameAvailabilityInner() { + } + + /** + * 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 cluster. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: name of the cluster. + * + * @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 cluster. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: type of the cluster. + * + * @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..0a1571c1fea5c --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/OperationInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlhsc.models.OperationDisplay; +import com.azure.resourcemanager.postgresqlhsc.models.OperationOrigin; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** REST API operation definition. */ +@Fluent +public final class OperationInner { + /* + * The name of the operation being performed on this particular object. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The localized display information for this particular operation or action. + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationDisplay display; + + /* + * Indicates whether the operation is a data action + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /* + * The intended executor of the operation. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private OperationOrigin origin; + + /* + * Additional descriptions for the operation. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map properties; + + /** Creates an instance of OperationInner class. */ + public OperationInner() { + } + + /** + * 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/PrivateEndpointConnectionActionRequestProperties.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateEndpointConnectionActionRequestProperties.java new file mode 100644 index 0000000000000..d30ecee6140bd --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateEndpointConnectionActionRequestProperties.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.resourcemanager.postgresqlhsc.models.PrivateLinkServiceConnectionState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties used to create a private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionActionRequestProperties { + /* + * Connection state of the private endpoint connection. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /** Creates an instance of PrivateEndpointConnectionActionRequestProperties class. */ + public PrivateEndpointConnectionActionRequestProperties() { + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionActionRequestProperties object itself. + */ + public PrivateEndpointConnectionActionRequestProperties withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateEndpointConnectionProperties.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..c4ca6fb6243a4 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,138 @@ +// 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.resourcemanager.postgresqlhsc.models.PrivateEndpointProperty; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties in private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionProperties { + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /* + * Group ids of the private endpoint connection. + */ + @JsonProperty(value = "groupIds") + private List groupIds; + + /* + * Connection state of the private endpoint connection. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * State of the private endpoint connection. + */ + @JsonProperty(value = "provisioningState") + private String provisioningState; + + /** Creates an instance of PrivateEndpointConnectionProperties class. */ + public PrivateEndpointConnectionProperties() { + } + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the groupIds property: Group ids of the private endpoint connection. + * + * @return the groupIds value. + */ + public List groupIds() { + return this.groupIds; + } + + /** + * Set the groupIds property: Group ids of the private endpoint connection. + * + * @param groupIds the groupIds value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withGroupIds(List groupIds) { + this.groupIds = groupIds; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: State of the private endpoint connection. + * + * @param provisioningState the provisioningState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateEndpointConnectionPropertyInner.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateEndpointConnectionPropertyInner.java new file mode 100644 index 0000000000000..fb56917d9d56d --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateEndpointConnectionPropertyInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointProperty; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A private endpoint connection property. */ +@Fluent +public final class PrivateEndpointConnectionPropertyInner extends ProxyResource { + /* + * Properties of the private endpoint connection. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of PrivateEndpointConnectionPropertyInner class. */ + public PrivateEndpointConnectionPropertyInner() { + } + + /** + * Get the innerProperties property: Properties of the private endpoint connection. + * + * @return the innerProperties value. + */ + private PrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionPropertyInner object itself. + */ + public PrivateEndpointConnectionPropertyInner withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the groupIds property: Group ids of the private endpoint connection. + * + * @return the groupIds value. + */ + public List groupIds() { + return this.innerProperties() == null ? null : this.innerProperties().groupIds(); + } + + /** + * Set the groupIds property: Group ids of the private endpoint connection. + * + * @param groupIds the groupIds value to set. + * @return the PrivateEndpointConnectionPropertyInner object itself. + */ + public PrivateEndpointConnectionPropertyInner withGroupIds(List groupIds) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withGroupIds(groupIds); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionPropertyInner object itself. + */ + public PrivateEndpointConnectionPropertyInner withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Set the provisioningState property: State of the private endpoint connection. + * + * @param provisioningState the provisioningState value to set. + * @return the PrivateEndpointConnectionPropertyInner object itself. + */ + public PrivateEndpointConnectionPropertyInner withProvisioningState(String provisioningState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withProvisioningState(provisioningState); + 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/PrivateEndpointConnectionSimpleProperties.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateEndpointConnectionSimpleProperties.java new file mode 100644 index 0000000000000..256fe3e8b42dc --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateEndpointConnectionSimpleProperties.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointProperty; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties in private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionSimpleProperties { + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /* + * Group ids of the private endpoint connection. + */ + @JsonProperty(value = "groupIds") + private List groupIds; + + /* + * Connection state of the private endpoint connection. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /** Creates an instance of PrivateEndpointConnectionSimpleProperties class. */ + public PrivateEndpointConnectionSimpleProperties() { + } + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionSimpleProperties object itself. + */ + public PrivateEndpointConnectionSimpleProperties withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the groupIds property: Group ids of the private endpoint connection. + * + * @return the groupIds value. + */ + public List groupIds() { + return this.groupIds; + } + + /** + * Set the groupIds property: Group ids of the private endpoint connection. + * + * @param groupIds the groupIds value to set. + * @return the PrivateEndpointConnectionSimpleProperties object itself. + */ + public PrivateEndpointConnectionSimpleProperties withGroupIds(List groupIds) { + this.groupIds = groupIds; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionSimpleProperties object itself. + */ + public PrivateEndpointConnectionSimpleProperties withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateLinkResourceInner.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 0000000000000..aba3f7ede812d --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateLinkResourceInner.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A private link resource. */ +@Fluent +public final class PrivateLinkResourceInner extends ProxyResource { + /* + * Properties of the private link resource. + */ + @JsonProperty(value = "properties") + private PrivateLinkResourceProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of PrivateLinkResourceInner class. */ + public PrivateLinkResourceInner() { + } + + /** + * Get the innerProperties property: Properties of the private link resource. + * + * @return the innerProperties value. + */ + private PrivateLinkResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.innerProperties() == null ? null : this.innerProperties().groupId(); + } + + /** + * Set the groupId property: The private link resource group id. + * + * @param groupId the groupId value to set. + * @return the PrivateLinkResourceInner object itself. + */ + public PrivateLinkResourceInner withGroupId(String groupId) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateLinkResourceProperties(); + } + this.innerProperties().withGroupId(groupId); + return this; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.innerProperties() == null ? null : this.innerProperties().requiredMembers(); + } + + /** + * Set the requiredMembers property: The private link resource required member names. + * + * @param requiredMembers the requiredMembers value to set. + * @return the PrivateLinkResourceInner object itself. + */ + public PrivateLinkResourceInner withRequiredMembers(List requiredMembers) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateLinkResourceProperties(); + } + this.innerProperties().withRequiredMembers(requiredMembers); + return this; + } + + /** + * Get the requiredZoneNames property: The private link resource zone names. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.innerProperties() == null ? null : this.innerProperties().requiredZoneNames(); + } + + /** + * Set the requiredZoneNames property: The private link resource zone names. + * + * @param requiredZoneNames the requiredZoneNames value to set. + * @return the PrivateLinkResourceInner object itself. + */ + public PrivateLinkResourceInner withRequiredZoneNames(List requiredZoneNames) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateLinkResourceProperties(); + } + this.innerProperties().withRequiredZoneNames(requiredZoneNames); + 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/PrivateLinkResourceProperties.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateLinkResourceProperties.java new file mode 100644 index 0000000000000..6d8f2643600fe --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateLinkResourceProperties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a private link resource. */ +@Fluent +public final class PrivateLinkResourceProperties { + /* + * The private link resource group id. + */ + @JsonProperty(value = "groupId") + private String groupId; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "requiredMembers") + private List requiredMembers; + + /* + * The private link resource zone names. + */ + @JsonProperty(value = "requiredZoneNames") + private List requiredZoneNames; + + /** Creates an instance of PrivateLinkResourceProperties class. */ + public PrivateLinkResourceProperties() { + } + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Set the groupId property: The private link resource group id. + * + * @param groupId the groupId value to set. + * @return the PrivateLinkResourceProperties object itself. + */ + public PrivateLinkResourceProperties withGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Set the requiredMembers property: The private link resource required member names. + * + * @param requiredMembers the requiredMembers value to set. + * @return the PrivateLinkResourceProperties object itself. + */ + public PrivateLinkResourceProperties withRequiredMembers(List requiredMembers) { + this.requiredMembers = requiredMembers; + return this; + } + + /** + * Get the requiredZoneNames property: The private link resource zone names. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Set the requiredZoneNames property: The private link resource zone names. + * + * @param requiredZoneNames the requiredZoneNames value to set. + * @return the PrivateLinkResourceProperties object itself. + */ + public PrivateLinkResourceProperties withRequiredZoneNames(List requiredZoneNames) { + this.requiredZoneNames = requiredZoneNames; + 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/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..f6d515acbe9a6 --- /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.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a cluster role. */ +@Fluent +public final class RoleInner extends ProxyResource { + /* + * The properties of a role. + */ + @JsonProperty(value = "properties") + private RoleProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of RoleInner class. */ + public RoleInner() { + } + + /** + * Get the innerProperties property: The properties of a role. + * + * @return the innerProperties value. + */ + private RoleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the password property: The password of the cluster role. + * + * @return the password value. + */ + public String password() { + return this.innerProperties() == null ? null : this.innerProperties().password(); + } + + /** + * Set the password property: The password of the cluster 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..2ca871e57f790 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/RoleProperties.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a cluster role. */ +@Fluent +public final class RoleProperties { + /* + * The password of the cluster role. + */ + @JsonProperty(value = "password", required = true) + private String password; + + /** Creates an instance of RoleProperties class. */ + public RoleProperties() { + } + + /** + * Get the password property: The password of the cluster role. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The password of the cluster 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RoleProperties.class); +} 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..c3f3d7a0840fb --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerConfigurationInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.models.ConfigurationDataType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a configuration. */ +@Fluent +public final class ServerConfigurationInner extends ProxyResource { + /* + * The properties of a configuration. + */ + @JsonProperty(value = "properties") + private ServerConfigurationProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of ServerConfigurationInner class. */ + public ServerConfigurationInner() { + } + + /** + * Get the innerProperties property: The properties of a configuration. + * + * @return the innerProperties value. + */ + private ServerConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the value property: Value of the configuration. + * + * @return the value value. + */ + public String value() { + return this.innerProperties() == null ? null : this.innerProperties().value(); + } + + /** + * Set the value property: Value of the configuration. + * + * @param value the value value to set. + * @return the 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(); + } + + /** + * Get the requiresRestart property: If configuration change requires restart. + * + * @return the requiresRestart value. + */ + public Boolean requiresRestart() { + return this.innerProperties() == null ? null : this.innerProperties().requiresRestart(); + } + + /** + * Set the requiresRestart property: If configuration change requires restart. + * + * @param requiresRestart the requiresRestart value to set. + * @return the ServerConfigurationInner object itself. + */ + public ServerConfigurationInner withRequiresRestart(Boolean requiresRestart) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerConfigurationProperties(); + } + this.innerProperties().withRequiresRestart(requiresRestart); + 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/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..bab818005e4f3 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerConfigurationProperties.java @@ -0,0 +1,161 @@ +// 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.JsonProperty; + +/** The properties of a configuration. */ +@Fluent +public final class ServerConfigurationProperties { + /* + * 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; + + /* + * If configuration change requires restart. + */ + @JsonProperty(value = "requiresRestart") + private Boolean requiresRestart; + + /** Creates an instance of ServerConfigurationProperties class. */ + public ServerConfigurationProperties() { + } + + /** + * 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; + } + + /** + * Get the requiresRestart property: If configuration change requires restart. + * + * @return the requiresRestart value. + */ + public Boolean requiresRestart() { + return this.requiresRestart; + } + + /** + * Set the requiresRestart property: If configuration change requires restart. + * + * @param requiresRestart the requiresRestart value to set. + * @return the ServerConfigurationProperties object itself. + */ + public ServerConfigurationProperties withRequiresRestart(Boolean requiresRestart) { + this.requiresRestart = requiresRestart; + return this; + } + + /** + * 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerConfigurationProperties.class); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerConfigurationRequestProperties.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerConfigurationRequestProperties.java new file mode 100644 index 0000000000000..baf4c1cd14aae --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerConfigurationRequestProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a configuration properties. */ +@Fluent +public final class ServerConfigurationRequestProperties { + /* + * Represents the value of a configuration. + */ + @JsonProperty(value = "value") + private String value; + + /** Creates an instance of ServerConfigurationRequestProperties class. */ + public ServerConfigurationRequestProperties() { + } + + /** + * Get the value property: Represents the value of a configuration. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Represents the value of a configuration. + * + * @param value the value value to set. + * @return the ServerConfigurationRequestProperties object itself. + */ + public ServerConfigurationRequestProperties withValue(String value) { + this.value = value; + 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/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..864f6c62e74c7 --- /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 CosmosDBForPostgreSql. The Microsoft Azure management API provides + * create, read, update, and delete functionality for Cosmos DB for PostgreSQL resources including clusters, servers, + * configurations, firewall rules, roles, private endpoint connections and private link resources. + */ +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..da7f5d7aafa7d --- /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 CosmosDBForPostgreSql. The Microsoft Azure management API provides create, + * read, update, and delete functionality for Cosmos DB for PostgreSQL resources including clusters, servers, + * configurations, firewall rules, roles, private endpoint connections and private link resources. + */ +package com.azure.resourcemanager.postgresqlhsc.fluent; diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClusterResponseImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClusterResponseImpl.java new file mode 100644 index 0000000000000..9f89bd797ba50 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClusterResponseImpl.java @@ -0,0 +1,496 @@ +// 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.ClusterResponseInner; +import com.azure.resourcemanager.postgresqlhsc.models.Cluster; +import com.azure.resourcemanager.postgresqlhsc.models.ClusterForUpdate; +import com.azure.resourcemanager.postgresqlhsc.models.ClusterResponse; +import com.azure.resourcemanager.postgresqlhsc.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnection; +import com.azure.resourcemanager.postgresqlhsc.models.ServerNameItem; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ClusterResponseImpl implements ClusterResponse, ClusterResponse.Definition, ClusterResponse.Update { + private ClusterResponseInner 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 String administratorLogin() { + return this.innerModel().administratorLogin(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String state() { + return this.innerModel().state(); + } + + public String postgresqlVersion() { + return this.innerModel().postgresqlVersion(); + } + + public String citusVersion() { + return this.innerModel().citusVersion(); + } + + public MaintenanceWindow maintenanceWindow() { + return this.innerModel().maintenanceWindow(); + } + + public String preferredPrimaryZone() { + return this.innerModel().preferredPrimaryZone(); + } + + public Boolean enableShardsOnCoordinator() { + return this.innerModel().enableShardsOnCoordinator(); + } + + public Boolean enableHa() { + return this.innerModel().enableHa(); + } + + public String coordinatorServerEdition() { + return this.innerModel().coordinatorServerEdition(); + } + + public Long coordinatorStorageQuotaInMb() { + return this.innerModel().coordinatorStorageQuotaInMb(); + } + + public Long coordinatorVCores() { + return this.innerModel().coordinatorVCores(); + } + + public Boolean coordinatorEnablePublicIpAccess() { + return this.innerModel().coordinatorEnablePublicIpAccess(); + } + + public String nodeServerEdition() { + return this.innerModel().nodeServerEdition(); + } + + public Long nodeCount() { + return this.innerModel().nodeCount(); + } + + public Long nodeStorageQuotaInMb() { + return this.innerModel().nodeStorageQuotaInMb(); + } + + public Long nodeVCores() { + return this.innerModel().nodeVCores(); + } + + public Boolean nodeEnablePublicIpAccess() { + return this.innerModel().nodeEnablePublicIpAccess(); + } + + public List serverNames() { + List inner = this.innerModel().serverNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String sourceResourceId() { + return this.innerModel().sourceResourceId(); + } + + public String sourceLocation() { + return this.innerModel().sourceLocation(); + } + + public List readReplicas() { + List inner = this.innerModel().readReplicas(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime earliestRestoreTime() { + return this.innerModel().earliestRestoreTime(); + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ClusterResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String clusterName; + + private Cluster createParameters; + + private ClusterForUpdate updateParameters; + + public ClusterResponseImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ClusterResponse create() { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .createOrUpdate(resourceGroupName, clusterName, createParameters, Context.NONE); + return this; + } + + public ClusterResponse create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .createOrUpdate(resourceGroupName, clusterName, createParameters, context); + return this; + } + + ClusterResponseImpl(String name, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerObject = new ClusterResponseInner(); + this.serviceManager = serviceManager; + this.clusterName = name; + this.createParameters = new Cluster(); + } + + public ClusterResponseImpl update() { + this.updateParameters = new ClusterForUpdate(); + return this; + } + + public ClusterResponse apply() { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .update(resourceGroupName, clusterName, updateParameters, Context.NONE); + return this; + } + + public ClusterResponse apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .update(resourceGroupName, clusterName, updateParameters, context); + return this; + } + + ClusterResponseImpl( + ClusterResponseInner innerObject, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.clusterName = Utils.getValueFromIdByName(innerObject.id(), "serverGroupsv2"); + } + + public ClusterResponse refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .getByResourceGroupWithResponse(resourceGroupName, clusterName, Context.NONE) + .getValue(); + return this; + } + + public ClusterResponse refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .getByResourceGroupWithResponse(resourceGroupName, clusterName, context) + .getValue(); + return this; + } + + public void restart() { + serviceManager.clusters().restart(resourceGroupName, clusterName); + } + + public void restart(Context context) { + serviceManager.clusters().restart(resourceGroupName, clusterName, context); + } + + public void start() { + serviceManager.clusters().start(resourceGroupName, clusterName); + } + + public void start(Context context) { + serviceManager.clusters().start(resourceGroupName, clusterName, context); + } + + public void stop() { + serviceManager.clusters().stop(resourceGroupName, clusterName); + } + + public void stop(Context context) { + serviceManager.clusters().stop(resourceGroupName, clusterName, context); + } + + public void promoteReadReplica() { + serviceManager.clusters().promoteReadReplica(resourceGroupName, clusterName); + } + + public void promoteReadReplica(Context context) { + serviceManager.clusters().promoteReadReplica(resourceGroupName, clusterName, context); + } + + public ClusterResponseImpl withRegion(Region location) { + this.createParameters.withLocation(location.toString()); + return this; + } + + public ClusterResponseImpl withRegion(String location) { + this.createParameters.withLocation(location); + return this; + } + + public ClusterResponseImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createParameters.withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ClusterResponseImpl withAdministratorLoginPassword(String administratorLoginPassword) { + if (isInCreateMode()) { + this.createParameters.withAdministratorLoginPassword(administratorLoginPassword); + return this; + } else { + this.updateParameters.withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + } + + public ClusterResponseImpl withPostgresqlVersion(String postgresqlVersion) { + if (isInCreateMode()) { + this.createParameters.withPostgresqlVersion(postgresqlVersion); + return this; + } else { + this.updateParameters.withPostgresqlVersion(postgresqlVersion); + return this; + } + } + + public ClusterResponseImpl withCitusVersion(String citusVersion) { + if (isInCreateMode()) { + this.createParameters.withCitusVersion(citusVersion); + return this; + } else { + this.updateParameters.withCitusVersion(citusVersion); + return this; + } + } + + public ClusterResponseImpl withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) { + if (isInCreateMode()) { + this.createParameters.withEnableShardsOnCoordinator(enableShardsOnCoordinator); + return this; + } else { + this.updateParameters.withEnableShardsOnCoordinator(enableShardsOnCoordinator); + return this; + } + } + + public ClusterResponseImpl withEnableHa(Boolean enableHa) { + if (isInCreateMode()) { + this.createParameters.withEnableHa(enableHa); + return this; + } else { + this.updateParameters.withEnableHa(enableHa); + return this; + } + } + + public ClusterResponseImpl withPreferredPrimaryZone(String preferredPrimaryZone) { + if (isInCreateMode()) { + this.createParameters.withPreferredPrimaryZone(preferredPrimaryZone); + return this; + } else { + this.updateParameters.withPreferredPrimaryZone(preferredPrimaryZone); + return this; + } + } + + public ClusterResponseImpl withCoordinatorServerEdition(String coordinatorServerEdition) { + if (isInCreateMode()) { + this.createParameters.withCoordinatorServerEdition(coordinatorServerEdition); + return this; + } else { + this.updateParameters.withCoordinatorServerEdition(coordinatorServerEdition); + return this; + } + } + + public ClusterResponseImpl withCoordinatorStorageQuotaInMb(Long coordinatorStorageQuotaInMb) { + if (isInCreateMode()) { + this.createParameters.withCoordinatorStorageQuotaInMb(coordinatorStorageQuotaInMb); + return this; + } else { + this.updateParameters.withCoordinatorStorageQuotaInMb(coordinatorStorageQuotaInMb); + return this; + } + } + + public ClusterResponseImpl withCoordinatorVCores(Long coordinatorVCores) { + if (isInCreateMode()) { + this.createParameters.withCoordinatorVCores(coordinatorVCores); + return this; + } else { + this.updateParameters.withCoordinatorVCores(coordinatorVCores); + return this; + } + } + + public ClusterResponseImpl withCoordinatorEnablePublicIpAccess(Boolean coordinatorEnablePublicIpAccess) { + if (isInCreateMode()) { + this.createParameters.withCoordinatorEnablePublicIpAccess(coordinatorEnablePublicIpAccess); + return this; + } else { + this.updateParameters.withCoordinatorEnablePublicIpAccess(coordinatorEnablePublicIpAccess); + return this; + } + } + + public ClusterResponseImpl withNodeServerEdition(String nodeServerEdition) { + if (isInCreateMode()) { + this.createParameters.withNodeServerEdition(nodeServerEdition); + return this; + } else { + this.updateParameters.withNodeServerEdition(nodeServerEdition); + return this; + } + } + + public ClusterResponseImpl withNodeCount(Long nodeCount) { + if (isInCreateMode()) { + this.createParameters.withNodeCount(nodeCount); + return this; + } else { + this.updateParameters.withNodeCount(nodeCount); + return this; + } + } + + public ClusterResponseImpl withNodeStorageQuotaInMb(Long nodeStorageQuotaInMb) { + if (isInCreateMode()) { + this.createParameters.withNodeStorageQuotaInMb(nodeStorageQuotaInMb); + return this; + } else { + this.updateParameters.withNodeStorageQuotaInMb(nodeStorageQuotaInMb); + return this; + } + } + + public ClusterResponseImpl withNodeVCores(Long nodeVCores) { + if (isInCreateMode()) { + this.createParameters.withNodeVCores(nodeVCores); + return this; + } else { + this.updateParameters.withNodeVCores(nodeVCores); + return this; + } + } + + public ClusterResponseImpl withNodeEnablePublicIpAccess(Boolean nodeEnablePublicIpAccess) { + this.createParameters.withNodeEnablePublicIpAccess(nodeEnablePublicIpAccess); + return this; + } + + public ClusterResponseImpl withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + if (isInCreateMode()) { + this.createParameters.withMaintenanceWindow(maintenanceWindow); + return this; + } else { + this.updateParameters.withMaintenanceWindow(maintenanceWindow); + return this; + } + } + + public ClusterResponseImpl withSourceResourceId(String sourceResourceId) { + this.createParameters.withSourceResourceId(sourceResourceId); + return this; + } + + public ClusterResponseImpl withSourceLocation(String sourceLocation) { + this.createParameters.withSourceLocation(sourceLocation); + 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/ClusterServerImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClusterServerImpl.java new file mode 100644 index 0000000000000..53c8ee3a80a80 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClusterServerImpl.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ClusterServerInner; +import com.azure.resourcemanager.postgresqlhsc.models.ClusterServer; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRole; + +public final class ClusterServerImpl implements ClusterServer { + private ClusterServerInner innerObject; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + ClusterServerImpl( + ClusterServerInner 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 String state() { + return this.innerModel().state(); + } + + public String haState() { + return this.innerModel().haState(); + } + + public String availabilityZone() { + return this.innerModel().availabilityZone(); + } + + public String postgresqlVersion() { + return this.innerModel().postgresqlVersion(); + } + + public String citusVersion() { + return this.innerModel().citusVersion(); + } + + public String 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 ClusterServerInner 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/ClustersClientImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClustersClientImpl.java new file mode 100644 index 0000000000000..953be74ac9a3d --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClustersClientImpl.java @@ -0,0 +1,2666 @@ +// 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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlhsc.fluent.ClustersClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ClusterResponseInner; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.postgresqlhsc.models.Cluster; +import com.azure.resourcemanager.postgresqlhsc.models.ClusterForUpdate; +import com.azure.resourcemanager.postgresqlhsc.models.ClusterListResult; +import com.azure.resourcemanager.postgresqlhsc.models.NameAvailabilityRequest; +import java.nio.ByteBuffer; +import java.util.UUID; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ClustersClient. */ +public final class ClustersClientImpl implements ClustersClient { + /** The proxy service used to perform REST calls. */ + private final ClustersService service; + + /** The service client containing this operation class. */ + private final CosmosDBForPostgreSqlImpl client; + + /** + * Initializes an instance of ClustersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ClustersClientImpl(CosmosDBForPostgreSqlImpl client) { + this.service = RestProxy.create(ClustersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBForPostgreSqlClusters to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBForPostgreSq") + public interface ClustersService { + @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") UUID 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") UUID 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/{clusterName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @BodyParam("application/json") Cluster parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @BodyParam("application/json") ClusterForUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/restart") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> restart( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/start") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> start( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/stop") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> stop( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/promote") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> promoteReadReplica( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @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") UUID 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 clusters 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 clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the clusters 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 clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the clusters 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 clusters as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all the clusters 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 clusters as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the clusters 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 clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all the clusters 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 clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List all the clusters 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 clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the clusters 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 clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the clusters 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 clusters as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List all the clusters 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 clusters as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the clusters 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 clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List all the clusters 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 clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Creates a new cluster with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The required parameters for creating or updating a cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a cluster in response body along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String clusterName, Cluster 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new cluster with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The required parameters for creating or updating a cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a cluster in response body along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String clusterName, Cluster 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + parameters, + accept, + context); + } + + /** + * Creates a new cluster with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The required parameters for creating or updating a cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClusterResponseInner> beginCreateOrUpdateAsync( + String resourceGroupName, String clusterName, Cluster parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, clusterName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ClusterResponseInner.class, + ClusterResponseInner.class, + this.client.getContext()); + } + + /** + * Creates a new cluster with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The required parameters for creating or updating a cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClusterResponseInner> beginCreateOrUpdateAsync( + String resourceGroupName, String clusterName, Cluster parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, clusterName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ClusterResponseInner.class, ClusterResponseInner.class, context); + } + + /** + * Creates a new cluster with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The required parameters for creating or updating a cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterResponseInner> beginCreateOrUpdate( + String resourceGroupName, String clusterName, Cluster parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, clusterName, parameters).getSyncPoller(); + } + + /** + * Creates a new cluster with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The required parameters for creating or updating a cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterResponseInner> beginCreateOrUpdate( + String resourceGroupName, String clusterName, Cluster parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, clusterName, parameters, context).getSyncPoller(); + } + + /** + * Creates a new cluster with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The required parameters for creating or updating a cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a cluster in response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String clusterName, Cluster parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, clusterName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new cluster with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The required parameters for creating or updating a cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a cluster in response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String clusterName, Cluster parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, clusterName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new cluster with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The required parameters for creating or updating a cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterResponseInner createOrUpdate(String resourceGroupName, String clusterName, Cluster parameters) { + return createOrUpdateAsync(resourceGroupName, clusterName, parameters).block(); + } + + /** + * Creates a new cluster with servers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The required parameters for creating or updating a cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterResponseInner createOrUpdate( + String resourceGroupName, String clusterName, Cluster parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, clusterName, parameters, context).block(); + } + + /** + * Gets information about a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + accept, + context); + } + + /** + * Gets information about a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String clusterName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, clusterName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets information about a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String clusterName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, clusterName, context).block(); + } + + /** + * Gets information about a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterResponseInner getByResourceGroup(String resourceGroupName, String clusterName) { + return getByResourceGroupWithResponse(resourceGroupName, clusterName, Context.NONE).getValue(); + } + + /** + * Deletes a cluster together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a cluster together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + accept, + context); + } + + /** + * Deletes a cluster together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String clusterName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, clusterName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a cluster together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String clusterName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, clusterName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a cluster together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String clusterName) { + return beginDeleteAsync(resourceGroupName, clusterName).getSyncPoller(); + } + + /** + * Deletes a cluster together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, Context context) { + return beginDeleteAsync(resourceGroupName, clusterName, context).getSyncPoller(); + } + + /** + * Deletes a cluster together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String clusterName) { + return beginDeleteAsync(resourceGroupName, clusterName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a cluster together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String clusterName, Context context) { + return beginDeleteAsync(resourceGroupName, clusterName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a cluster together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 clusterName) { + deleteAsync(resourceGroupName, clusterName).block(); + } + + /** + * Deletes a cluster together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 clusterName, Context context) { + deleteAsync(resourceGroupName, clusterName, context).block(); + } + + /** + * Updates an existing cluster. The request body can contain one to many of the properties present in the normal + * cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The parameters for updating a cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a cluster in response body along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String clusterName, ClusterForUpdate 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing cluster. The request body can contain one to many of the properties present in the normal + * cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The parameters for updating a cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a cluster in response body along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String clusterName, ClusterForUpdate 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + parameters, + accept, + context); + } + + /** + * Updates an existing cluster. The request body can contain one to many of the properties present in the normal + * cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The parameters for updating a cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClusterResponseInner> beginUpdateAsync( + String resourceGroupName, String clusterName, ClusterForUpdate parameters) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, clusterName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ClusterResponseInner.class, + ClusterResponseInner.class, + this.client.getContext()); + } + + /** + * Updates an existing cluster. The request body can contain one to many of the properties present in the normal + * cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The parameters for updating a cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClusterResponseInner> beginUpdateAsync( + String resourceGroupName, String clusterName, ClusterForUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, clusterName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ClusterResponseInner.class, ClusterResponseInner.class, context); + } + + /** + * Updates an existing cluster. The request body can contain one to many of the properties present in the normal + * cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The parameters for updating a cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterResponseInner> beginUpdate( + String resourceGroupName, String clusterName, ClusterForUpdate parameters) { + return beginUpdateAsync(resourceGroupName, clusterName, parameters).getSyncPoller(); + } + + /** + * Updates an existing cluster. The request body can contain one to many of the properties present in the normal + * cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The parameters for updating a cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterResponseInner> beginUpdate( + String resourceGroupName, String clusterName, ClusterForUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, clusterName, parameters, context).getSyncPoller(); + } + + /** + * Updates an existing cluster. The request body can contain one to many of the properties present in the normal + * cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The parameters for updating a cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a cluster in response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String clusterName, ClusterForUpdate parameters) { + return beginUpdateAsync(resourceGroupName, clusterName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing cluster. The request body can contain one to many of the properties present in the normal + * cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The parameters for updating a cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a cluster in response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String clusterName, ClusterForUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, clusterName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing cluster. The request body can contain one to many of the properties present in the normal + * cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The parameters for updating a cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterResponseInner update(String resourceGroupName, String clusterName, ClusterForUpdate parameters) { + return updateAsync(resourceGroupName, clusterName, parameters).block(); + } + + /** + * Updates an existing cluster. The request body can contain one to many of the properties present in the normal + * cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param parameters The parameters for updating a cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a cluster in response body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterResponseInner update( + String resourceGroupName, String clusterName, ClusterForUpdate parameters, Context context) { + return updateAsync(resourceGroupName, clusterName, parameters, context).block(); + } + + /** + * Restarts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> restartWithResponseAsync(String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Restarts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> restartWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + accept, + context); + } + + /** + * Restarts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync(String resourceGroupName, String clusterName) { + Mono>> mono = restartWithResponseAsync(resourceGroupName, clusterName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Restarts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String clusterName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = restartWithResponseAsync(resourceGroupName, clusterName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Restarts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart(String resourceGroupName, String clusterName) { + return beginRestartAsync(resourceGroupName, clusterName).getSyncPoller(); + } + + /** + * Restarts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String clusterName, Context context) { + return beginRestartAsync(resourceGroupName, clusterName, context).getSyncPoller(); + } + + /** + * Restarts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restartAsync(String resourceGroupName, String clusterName) { + return beginRestartAsync(resourceGroupName, clusterName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restarts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restartAsync(String resourceGroupName, String clusterName, Context context) { + return beginRestartAsync(resourceGroupName, clusterName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restarts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 clusterName) { + restartAsync(resourceGroupName, clusterName).block(); + } + + /** + * Restarts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 clusterName, Context context) { + restartAsync(resourceGroupName, clusterName, context).block(); + } + + /** + * Starts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync(String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Starts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + accept, + context); + } + + /** + * Starts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync(String resourceGroupName, String clusterName) { + Mono>> mono = startWithResponseAsync(resourceGroupName, clusterName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Starts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String clusterName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = startWithResponseAsync(resourceGroupName, clusterName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Starts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart(String resourceGroupName, String clusterName) { + return beginStartAsync(resourceGroupName, clusterName).getSyncPoller(); + } + + /** + * Starts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart( + String resourceGroupName, String clusterName, Context context) { + return beginStartAsync(resourceGroupName, clusterName, context).getSyncPoller(); + } + + /** + * Starts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String clusterName) { + return beginStartAsync(resourceGroupName, clusterName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String clusterName, Context context) { + return beginStartAsync(resourceGroupName, clusterName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 clusterName) { + startAsync(resourceGroupName, clusterName).block(); + } + + /** + * Starts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 clusterName, Context context) { + startAsync(resourceGroupName, clusterName, context).block(); + } + + /** + * Stops the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> stopWithResponseAsync(String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Stops the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> stopWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + accept, + context); + } + + /** + * Stops the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStopAsync(String resourceGroupName, String clusterName) { + Mono>> mono = stopWithResponseAsync(resourceGroupName, clusterName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Stops the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStopAsync( + String resourceGroupName, String clusterName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = stopWithResponseAsync(resourceGroupName, clusterName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Stops the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStop(String resourceGroupName, String clusterName) { + return beginStopAsync(resourceGroupName, clusterName).getSyncPoller(); + } + + /** + * Stops the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStop(String resourceGroupName, String clusterName, Context context) { + return beginStopAsync(resourceGroupName, clusterName, context).getSyncPoller(); + } + + /** + * Stops the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync(String resourceGroupName, String clusterName) { + return beginStopAsync(resourceGroupName, clusterName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Stops the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync(String resourceGroupName, String clusterName, Context context) { + return beginStopAsync(resourceGroupName, clusterName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Stops the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 clusterName) { + stopAsync(resourceGroupName, clusterName).block(); + } + + /** + * Stops the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 clusterName, Context context) { + stopAsync(resourceGroupName, clusterName, context).block(); + } + + /** + * Promote the read replica cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> promoteReadReplicaWithResponseAsync( + String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .promoteReadReplica( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Promote the read replica cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> promoteReadReplicaWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .promoteReadReplica( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + accept, + context); + } + + /** + * Promote the read replica cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPromoteReadReplicaAsync( + String resourceGroupName, String clusterName) { + Mono>> mono = promoteReadReplicaWithResponseAsync(resourceGroupName, clusterName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Promote the read replica cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPromoteReadReplicaAsync( + String resourceGroupName, String clusterName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + promoteReadReplicaWithResponseAsync(resourceGroupName, clusterName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Promote the read replica cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPromoteReadReplica(String resourceGroupName, String clusterName) { + return beginPromoteReadReplicaAsync(resourceGroupName, clusterName).getSyncPoller(); + } + + /** + * Promote the read replica cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPromoteReadReplica( + String resourceGroupName, String clusterName, Context context) { + return beginPromoteReadReplicaAsync(resourceGroupName, clusterName, context).getSyncPoller(); + } + + /** + * Promote the read replica cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono promoteReadReplicaAsync(String resourceGroupName, String clusterName) { + return beginPromoteReadReplicaAsync(resourceGroupName, clusterName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Promote the read replica cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono promoteReadReplicaAsync(String resourceGroupName, String clusterName, Context context) { + return beginPromoteReadReplicaAsync(resourceGroupName, clusterName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Promote the read replica cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 promoteReadReplica(String resourceGroupName, String clusterName) { + promoteReadReplicaAsync(resourceGroupName, clusterName).block(); + } + + /** + * Promote the read replica cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 promoteReadReplica(String resourceGroupName, String clusterName, Context context) { + promoteReadReplicaAsync(resourceGroupName, clusterName, 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync(NameAvailabilityRequest nameAvailabilityRequest) { + return checkNameAvailabilityWithResponseAsync(nameAvailabilityRequest) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + NameAvailabilityRequest nameAvailabilityRequest, Context context) { + return checkNameAvailabilityWithResponseAsync(nameAvailabilityRequest, context).block(); + } + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NameAvailabilityInner checkNameAvailability(NameAvailabilityRequest nameAvailabilityRequest) { + return checkNameAvailabilityWithResponse(nameAvailabilityRequest, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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

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

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

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClustersImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClustersImpl.java new file mode 100644 index 0000000000000..221eff82b23b3 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClustersImpl.java @@ -0,0 +1,233 @@ +// 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.ClustersClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ClusterResponseInner; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.postgresqlhsc.models.ClusterResponse; +import com.azure.resourcemanager.postgresqlhsc.models.Clusters; +import com.azure.resourcemanager.postgresqlhsc.models.NameAvailability; +import com.azure.resourcemanager.postgresqlhsc.models.NameAvailabilityRequest; + +public final class ClustersImpl implements Clusters { + private static final ClientLogger LOGGER = new ClientLogger(ClustersImpl.class); + + private final ClustersClient innerClient; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + public ClustersImpl( + ClustersClient 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 ClusterResponseImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ClusterResponseImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ClusterResponseImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ClusterResponseImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String clusterName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, clusterName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ClusterResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ClusterResponse getByResourceGroup(String resourceGroupName, String clusterName) { + ClusterResponseInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, clusterName); + if (inner != null) { + return new ClusterResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String clusterName) { + this.serviceClient().delete(resourceGroupName, clusterName); + } + + public void delete(String resourceGroupName, String clusterName, Context context) { + this.serviceClient().delete(resourceGroupName, clusterName, context); + } + + public void restart(String resourceGroupName, String clusterName) { + this.serviceClient().restart(resourceGroupName, clusterName); + } + + public void restart(String resourceGroupName, String clusterName, Context context) { + this.serviceClient().restart(resourceGroupName, clusterName, context); + } + + public void start(String resourceGroupName, String clusterName) { + this.serviceClient().start(resourceGroupName, clusterName); + } + + public void start(String resourceGroupName, String clusterName, Context context) { + this.serviceClient().start(resourceGroupName, clusterName, context); + } + + public void stop(String resourceGroupName, String clusterName) { + this.serviceClient().stop(resourceGroupName, clusterName); + } + + public void stop(String resourceGroupName, String clusterName, Context context) { + this.serviceClient().stop(resourceGroupName, clusterName, context); + } + + public void promoteReadReplica(String resourceGroupName, String clusterName) { + this.serviceClient().promoteReadReplica(resourceGroupName, clusterName); + } + + public void promoteReadReplica(String resourceGroupName, String clusterName, Context context) { + this.serviceClient().promoteReadReplica(resourceGroupName, clusterName, context); + } + + 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 NameAvailability checkNameAvailability(NameAvailabilityRequest nameAvailabilityRequest) { + NameAvailabilityInner inner = this.serviceClient().checkNameAvailability(nameAvailabilityRequest); + if (inner != null) { + return new NameAvailabilityImpl(inner, this.manager()); + } else { + return null; + } + } + + public ClusterResponse 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 clusterName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, clusterName, 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 clusterName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, clusterName, 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 clusterName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", id))); + } + this.delete(resourceGroupName, clusterName, 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 clusterName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", id))); + } + this.delete(resourceGroupName, clusterName, context); + } + + private ClustersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } + + public ClusterResponseImpl define(String name) { + return new ClusterResponseImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ConfigurationImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ConfigurationImpl.java new file mode 100644 index 0000000000000..fab980a8e163f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ConfigurationImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.postgresqlhsc.models.Configuration; +import com.azure.resourcemanager.postgresqlhsc.models.ConfigurationDataType; +import com.azure.resourcemanager.postgresqlhsc.models.ServerRoleGroupConfiguration; +import java.util.Collections; +import java.util.List; + +public final class ConfigurationImpl implements Configuration { + private ConfigurationInner innerObject; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + ConfigurationImpl( + ConfigurationInner 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 Boolean requiresRestart() { + return this.innerModel().requiresRestart(); + } + + public List serverRoleGroupConfigurations() { + List inner = this.innerModel().serverRoleGroupConfigurations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ConfigurationInner 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/ConfigurationsClientImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ConfigurationsClientImpl.java new file mode 100644 index 0000000000000..4fa4ff9234e9d --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ConfigurationsClientImpl.java @@ -0,0 +1,1486 @@ +// 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.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlhsc.fluent.ConfigurationsClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationInner; +import com.azure.resourcemanager.postgresqlhsc.models.ClusterConfigurationListResult; +import com.azure.resourcemanager.postgresqlhsc.models.ServerConfigurationListResult; +import com.azure.resourcemanager.postgresqlhsc.models.ServerConfigurationRequest; +import java.nio.ByteBuffer; +import java.util.UUID; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ConfigurationsClient. */ +public final class ConfigurationsClientImpl implements ConfigurationsClient { + /** The proxy service used to perform REST calls. */ + private final ConfigurationsService service; + + /** The service client containing this operation class. */ + private final CosmosDBForPostgreSqlImpl client; + + /** + * Initializes an instance of ConfigurationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ConfigurationsClientImpl(CosmosDBForPostgreSqlImpl client) { + this.service = + RestProxy.create(ConfigurationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBForPostgreSqlConfigurations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBForPostgreSq") + public interface ConfigurationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/servers/{serverName}/configurations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/configurations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCluster( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/configurations/{configurationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("configurationName") String configurationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/configurations/{configurationName}/coordinator") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateCoordinator( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("configurationName") String configurationName, + @BodyParam("application/json") ServerConfigurationRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/configurations/{configurationName}/node") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateNode( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("configurationName") String configurationName, + @BodyParam("application/json") ServerConfigurationRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByClusterNext( + @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 cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + 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 cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + 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 cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String clusterName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, clusterName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * List all the configurations of a server in cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String clusterName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, clusterName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the configurations of a server in cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String clusterName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, clusterName, serverName)); + } + + /** + * List all the configurations of a server in cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String clusterName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, clusterName, serverName, context)); + } + + /** + * List all the configurations of a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of cluster configurations along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByClusterSinglePageAsync( + String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByCluster( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + 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 cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of cluster configurations along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByClusterSinglePageAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCluster( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + 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 cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of cluster configurations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByClusterAsync(String resourceGroupName, String clusterName) { + return new PagedFlux<>( + () -> listByClusterSinglePageAsync(resourceGroupName, clusterName), + nextLink -> listByClusterNextSinglePageAsync(nextLink)); + } + + /** + * List all the configurations of a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of cluster configurations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByClusterAsync( + String resourceGroupName, String clusterName, Context context) { + return new PagedFlux<>( + () -> listByClusterSinglePageAsync(resourceGroupName, clusterName, context), + nextLink -> listByClusterNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the configurations of a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of cluster configurations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCluster(String resourceGroupName, String clusterName) { + return new PagedIterable<>(listByClusterAsync(resourceGroupName, clusterName)); + } + + /** + * List all the configurations of a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of cluster configurations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCluster( + String resourceGroupName, String clusterName, Context context) { + return new PagedIterable<>(listByClusterAsync(resourceGroupName, clusterName, context)); + } + + /** + * Gets information of a configuration for coordinator and nodes. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster 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 of a configuration for coordinator and nodes along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + configurationName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information of a configuration for coordinator and nodes. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster 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 of a configuration for coordinator and nodes along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + configurationName, + accept, + context); + } + + /** + * Gets information of a configuration for coordinator and nodes. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster 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 of a configuration for coordinator and nodes on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String clusterName, String configurationName) { + return getWithResponseAsync(resourceGroupName, clusterName, configurationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets information of a configuration for coordinator and nodes. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster 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 of a configuration for coordinator and nodes along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String clusterName, String configurationName, Context context) { + return getWithResponseAsync(resourceGroupName, clusterName, configurationName, context).block(); + } + + /** + * Gets information of a configuration for coordinator and nodes. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster 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 of a configuration for coordinator and nodes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationInner get(String resourceGroupName, String clusterName, String configurationName) { + return getWithResponse(resourceGroupName, clusterName, configurationName, Context.NONE).getValue(); + } + + /** + * Updates configuration of coordinator in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateCoordinatorWithResponseAsync( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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 + .updateCoordinator( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + configurationName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates configuration of coordinator in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateCoordinatorWithResponseAsync( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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 + .updateCoordinator( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + configurationName, + parameters, + accept, + context); + } + + /** + * Updates configuration of coordinator in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerConfigurationInner> beginUpdateCoordinatorAsync( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest parameters) { + Mono>> mono = + updateCoordinatorWithResponseAsync(resourceGroupName, clusterName, configurationName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerConfigurationInner.class, + ServerConfigurationInner.class, + this.client.getContext()); + } + + /** + * Updates configuration of coordinator in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerConfigurationInner> beginUpdateCoordinatorAsync( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateCoordinatorWithResponseAsync(resourceGroupName, clusterName, configurationName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerConfigurationInner.class, + ServerConfigurationInner.class, + context); + } + + /** + * Updates configuration of coordinator in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerConfigurationInner> beginUpdateCoordinator( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest parameters) { + return beginUpdateCoordinatorAsync(resourceGroupName, clusterName, configurationName, parameters) + .getSyncPoller(); + } + + /** + * Updates configuration of coordinator in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerConfigurationInner> beginUpdateCoordinator( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest parameters, + Context context) { + return beginUpdateCoordinatorAsync(resourceGroupName, clusterName, configurationName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates configuration of coordinator in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateCoordinatorAsync( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest parameters) { + return beginUpdateCoordinatorAsync(resourceGroupName, clusterName, configurationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates configuration of coordinator in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateCoordinatorAsync( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest parameters, + Context context) { + return beginUpdateCoordinatorAsync(resourceGroupName, clusterName, configurationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates configuration of coordinator in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerConfigurationInner updateCoordinator( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest parameters) { + return updateCoordinatorAsync(resourceGroupName, clusterName, configurationName, parameters).block(); + } + + /** + * Updates configuration of coordinator in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerConfigurationInner updateCoordinator( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest parameters, + Context context) { + return updateCoordinatorAsync(resourceGroupName, clusterName, configurationName, parameters, context).block(); + } + + /** + * Updates configuration of nodes in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateNodeWithResponseAsync( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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 + .updateNode( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + configurationName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates configuration of nodes in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateNodeWithResponseAsync( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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 + .updateNode( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + configurationName, + parameters, + accept, + context); + } + + /** + * Updates configuration of nodes in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerConfigurationInner> beginUpdateNodeAsync( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest parameters) { + Mono>> mono = + updateNodeWithResponseAsync(resourceGroupName, clusterName, configurationName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerConfigurationInner.class, + ServerConfigurationInner.class, + this.client.getContext()); + } + + /** + * Updates configuration of nodes in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerConfigurationInner> beginUpdateNodeAsync( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateNodeWithResponseAsync(resourceGroupName, clusterName, configurationName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerConfigurationInner.class, + ServerConfigurationInner.class, + context); + } + + /** + * Updates configuration of nodes in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerConfigurationInner> beginUpdateNode( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest parameters) { + return beginUpdateNodeAsync(resourceGroupName, clusterName, configurationName, parameters).getSyncPoller(); + } + + /** + * Updates configuration of nodes in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerConfigurationInner> beginUpdateNode( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest parameters, + Context context) { + return beginUpdateNodeAsync(resourceGroupName, clusterName, configurationName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates configuration of nodes in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateNodeAsync( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest parameters) { + return beginUpdateNodeAsync(resourceGroupName, clusterName, configurationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates configuration of nodes in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateNodeAsync( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest parameters, + Context context) { + return beginUpdateNodeAsync(resourceGroupName, clusterName, configurationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates configuration of nodes in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerConfigurationInner updateNode( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest parameters) { + return updateNodeAsync(resourceGroupName, clusterName, configurationName, parameters).block(); + } + + /** + * Updates configuration of nodes in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerConfigurationInner updateNode( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest parameters, + Context context) { + return updateNodeAsync(resourceGroupName, clusterName, configurationName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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

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

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

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of cluster configurations along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByClusterNextSinglePageAsync(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 + .listByClusterNext(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..e4bcee28b96cd --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ConfigurationsImpl.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.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.ConfigurationInner; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationInner; +import com.azure.resourcemanager.postgresqlhsc.models.Configuration; +import com.azure.resourcemanager.postgresqlhsc.models.Configurations; +import com.azure.resourcemanager.postgresqlhsc.models.ServerConfiguration; +import com.azure.resourcemanager.postgresqlhsc.models.ServerConfigurationRequest; + +public final class ConfigurationsImpl implements Configurations { + private static 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 clusterName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, clusterName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerConfigurationImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String clusterName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, clusterName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerConfigurationImpl(inner1, this.manager())); + } + + public PagedIterable listByCluster(String resourceGroupName, String clusterName) { + PagedIterable inner = this.serviceClient().listByCluster(resourceGroupName, clusterName); + return Utils.mapPage(inner, inner1 -> new ConfigurationImpl(inner1, this.manager())); + } + + public PagedIterable listByCluster(String resourceGroupName, String clusterName, Context context) { + PagedIterable inner = + this.serviceClient().listByCluster(resourceGroupName, clusterName, context); + return Utils.mapPage(inner, inner1 -> new ConfigurationImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String clusterName, String configurationName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, clusterName, configurationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Configuration get(String resourceGroupName, String clusterName, String configurationName) { + ConfigurationInner inner = this.serviceClient().get(resourceGroupName, clusterName, configurationName); + if (inner != null) { + return new ConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerConfiguration updateCoordinator( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest parameters) { + ServerConfigurationInner inner = + this.serviceClient().updateCoordinator(resourceGroupName, clusterName, configurationName, parameters); + if (inner != null) { + return new ServerConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerConfiguration updateCoordinator( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest parameters, + Context context) { + ServerConfigurationInner inner = + this + .serviceClient() + .updateCoordinator(resourceGroupName, clusterName, configurationName, parameters, context); + if (inner != null) { + return new ServerConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerConfiguration updateNode( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest parameters) { + ServerConfigurationInner inner = + this.serviceClient().updateNode(resourceGroupName, clusterName, configurationName, parameters); + if (inner != null) { + return new ServerConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerConfiguration updateNode( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest parameters, + Context context) { + ServerConfigurationInner inner = + this.serviceClient().updateNode(resourceGroupName, clusterName, configurationName, parameters, context); + if (inner != null) { + return new ServerConfigurationImpl(inner, 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/CosmosDBForPostgreSqlBuilder.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/CosmosDBForPostgreSqlBuilder.java new file mode 100644 index 0000000000000..066359fb7dcab --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/CosmosDBForPostgreSqlBuilder.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.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; +import java.util.UUID; + +/** A builder for creating a new instance of the CosmosDBForPostgreSqlImpl type. */ +@ServiceClientBuilder(serviceClients = {CosmosDBForPostgreSqlImpl.class}) +public final class CosmosDBForPostgreSqlBuilder { + /* + * The ID of the target subscription. The value must be an UUID. + */ + private UUID subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the CosmosDBForPostgreSqlBuilder. + */ + public CosmosDBForPostgreSqlBuilder subscriptionId(UUID subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the CosmosDBForPostgreSqlBuilder. + */ + public CosmosDBForPostgreSqlBuilder 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 CosmosDBForPostgreSqlBuilder. + */ + public CosmosDBForPostgreSqlBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the CosmosDBForPostgreSqlBuilder. + */ + public CosmosDBForPostgreSqlBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the CosmosDBForPostgreSqlBuilder. + */ + public CosmosDBForPostgreSqlBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the CosmosDBForPostgreSqlBuilder. + */ + public CosmosDBForPostgreSqlBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of CosmosDBForPostgreSqlImpl with the provided parameters. + * + * @return an instance of CosmosDBForPostgreSqlImpl. + */ + public CosmosDBForPostgreSqlImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + CosmosDBForPostgreSqlImpl client = + new CosmosDBForPostgreSqlImpl( + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + subscriptionId, + localEndpoint); + return client; + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/CosmosDBForPostgreSqlImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/CosmosDBForPostgreSqlImpl.java new file mode 100644 index 0000000000000..8d2fba6a03ee0 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/CosmosDBForPostgreSqlImpl.java @@ -0,0 +1,389 @@ +// 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.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.postgresqlhsc.fluent.ClustersClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.ConfigurationsClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.CosmosDBForPostgreSql; +import com.azure.resourcemanager.postgresqlhsc.fluent.FirewallRulesClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.OperationsClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.RolesClient; +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.UUID; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the CosmosDBForPostgreSqlImpl type. */ +@ServiceClient(builder = CosmosDBForPostgreSqlBuilder.class) +public final class CosmosDBForPostgreSqlImpl implements CosmosDBForPostgreSql { + /** The ID of the target subscription. The value must be an UUID. */ + private final UUID subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public UUID 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 ClustersClient object to access its operations. */ + private final ClustersClient clusters; + + /** + * Gets the ClustersClient object to access its operations. + * + * @return the ClustersClient object. + */ + public ClustersClient getClusters() { + return this.clusters; + } + + /** 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; + } + + /** The PrivateEndpointConnectionsClient object to access its operations. */ + private final PrivateEndpointConnectionsClient privateEndpointConnections; + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** The PrivateLinkResourcesClient object to access its operations. */ + private final PrivateLinkResourcesClient privateLinkResources; + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + public PrivateLinkResourcesClient getPrivateLinkResources() { + return this.privateLinkResources; + } + + /** + * Initializes an instance of CosmosDBForPostgreSql 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. The value must be an UUID. + * @param endpoint server parameter. + */ + CosmosDBForPostgreSqlImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + UUID subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2022-11-08"; + this.clusters = new ClustersClientImpl(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); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CosmosDBForPostgreSqlImpl.class); +} 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..47f153db61795 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/FirewallRuleImpl.java @@ -0,0 +1,149 @@ +// 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 String resourceGroupName() { + return resourceGroupName; + } + + public FirewallRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String clusterName; + + private String firewallRuleName; + + public FirewallRuleImpl withExistingServerGroupsv2(String resourceGroupName, String clusterName) { + this.resourceGroupName = resourceGroupName; + this.clusterName = clusterName; + return this; + } + + public FirewallRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, clusterName, firewallRuleName, this.innerModel(), Context.NONE); + return this; + } + + public FirewallRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, clusterName, 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, clusterName, firewallRuleName, this.innerModel(), Context.NONE); + return this; + } + + public FirewallRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, clusterName, 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.clusterName = Utils.getValueFromIdByName(innerObject.id(), "serverGroupsv2"); + this.firewallRuleName = Utils.getValueFromIdByName(innerObject.id(), "firewallRules"); + } + + public FirewallRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .getWithResponse(resourceGroupName, clusterName, firewallRuleName, Context.NONE) + .getValue(); + return this; + } + + public FirewallRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .getWithResponse(resourceGroupName, clusterName, 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..42354d3b6d163 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/FirewallRulesClientImpl.java @@ -0,0 +1,1020 @@ +// 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.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 java.util.UUID; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in FirewallRulesClient. */ +public final class FirewallRulesClientImpl implements FirewallRulesClient { + /** The proxy service used to perform REST calls. */ + private final FirewallRulesService service; + + /** The service client containing this operation class. */ + private final CosmosDBForPostgreSqlImpl client; + + /** + * Initializes an instance of FirewallRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FirewallRulesClientImpl(CosmosDBForPostgreSqlImpl client) { + this.service = + RestProxy.create(FirewallRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBForPostgreSqlFirewallRules to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBForPostgreSq") + public interface FirewallRulesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @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/{clusterName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("firewallRuleName") String firewallRuleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("firewallRuleName") String firewallRuleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/firewallRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCluster( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @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 clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + 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 clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String clusterName, + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + 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 clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, String clusterName, String firewallRuleName, FirewallRuleInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, clusterName, 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 clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String clusterName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, clusterName, 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 clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, String clusterName, String firewallRuleName, FirewallRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, clusterName, 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 clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String clusterName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, clusterName, 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 clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String clusterName, String firewallRuleName, FirewallRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, clusterName, 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 clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String clusterName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, clusterName, 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 clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner createOrUpdate( + String resourceGroupName, String clusterName, String firewallRuleName, FirewallRuleInner parameters) { + return createOrUpdateAsync(resourceGroupName, clusterName, 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 clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner createOrUpdate( + String resourceGroupName, + String clusterName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, clusterName, firewallRuleName, parameters, context).block(); + } + + /** + * Deletes a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + firewallRuleName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + firewallRuleName, + accept, + context); + } + + /** + * Deletes a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String clusterName, String firewallRuleName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, clusterName, firewallRuleName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String clusterName, String firewallRuleName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, clusterName, firewallRuleName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, String firewallRuleName) { + return beginDeleteAsync(resourceGroupName, clusterName, firewallRuleName).getSyncPoller(); + } + + /** + * Deletes a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, String firewallRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, clusterName, firewallRuleName, context).getSyncPoller(); + } + + /** + * Deletes a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String clusterName, String firewallRuleName) { + return beginDeleteAsync(resourceGroupName, clusterName, firewallRuleName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String clusterName, String firewallRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, clusterName, firewallRuleName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 clusterName, String firewallRuleName) { + deleteAsync(resourceGroupName, clusterName, firewallRuleName).block(); + } + + /** + * Deletes a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 clusterName, String firewallRuleName, Context context) { + deleteAsync(resourceGroupName, clusterName, firewallRuleName, context).block(); + } + + /** + * Gets information about a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + firewallRuleName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + firewallRuleName, + accept, + context); + } + + /** + * Gets information about a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String clusterName, String firewallRuleName) { + return getWithResponseAsync(resourceGroupName, clusterName, firewallRuleName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets information about a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String clusterName, String firewallRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, clusterName, firewallRuleName, context).block(); + } + + /** + * Gets information about a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner get(String resourceGroupName, String clusterName, String firewallRuleName) { + return getWithResponse(resourceGroupName, clusterName, firewallRuleName, Context.NONE).getValue(); + } + + /** + * List all the firewall rules in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByClusterSinglePageAsync( + String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByCluster( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + 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 cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByClusterSinglePageAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCluster( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + 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 cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByClusterAsync(String resourceGroupName, String clusterName) { + return new PagedFlux<>(() -> listByClusterSinglePageAsync(resourceGroupName, clusterName)); + } + + /** + * List all the firewall rules in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByClusterAsync( + String resourceGroupName, String clusterName, Context context) { + return new PagedFlux<>(() -> listByClusterSinglePageAsync(resourceGroupName, clusterName, context)); + } + + /** + * List all the firewall rules in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCluster(String resourceGroupName, String clusterName) { + return new PagedIterable<>(listByClusterAsync(resourceGroupName, clusterName)); + } + + /** + * List all the firewall rules in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCluster( + String resourceGroupName, String clusterName, Context context) { + return new PagedIterable<>(listByClusterAsync(resourceGroupName, clusterName, 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..c9549a4840b93 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/FirewallRulesImpl.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.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; + +public final class FirewallRulesImpl implements FirewallRules { + private static 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 clusterName, String firewallRuleName) { + this.serviceClient().delete(resourceGroupName, clusterName, firewallRuleName); + } + + public void delete(String resourceGroupName, String clusterName, String firewallRuleName, Context context) { + this.serviceClient().delete(resourceGroupName, clusterName, firewallRuleName, context); + } + + public Response getWithResponse( + String resourceGroupName, String clusterName, String firewallRuleName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, clusterName, firewallRuleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FirewallRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public FirewallRule get(String resourceGroupName, String clusterName, String firewallRuleName) { + FirewallRuleInner inner = this.serviceClient().get(resourceGroupName, clusterName, firewallRuleName); + if (inner != null) { + return new FirewallRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByCluster(String resourceGroupName, String clusterName) { + PagedIterable inner = this.serviceClient().listByCluster(resourceGroupName, clusterName); + return Utils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByCluster(String resourceGroupName, String clusterName, Context context) { + PagedIterable inner = + this.serviceClient().listByCluster(resourceGroupName, clusterName, 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 clusterName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (clusterName == 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, clusterName, 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 clusterName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (clusterName == 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, clusterName, 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 clusterName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (clusterName == 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, clusterName, 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 clusterName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (clusterName == 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, clusterName, 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/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..77ac9d9d1ea4d --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/OperationsClientImpl.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.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 { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final CosmosDBForPostgreSqlImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(CosmosDBForPostgreSqlImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBForPostgreSqlOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBForPostgreSq") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.DBforPostgreSQL/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..76dec6fb15e74 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/OperationsImpl.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.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; + +public final class OperationsImpl implements Operations { + private static 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/PrivateEndpointConnectionPropertyImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateEndpointConnectionPropertyImpl.java new file mode 100644 index 0000000000000..23cd0b893c974 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateEndpointConnectionPropertyImpl.java @@ -0,0 +1,193 @@ +// 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.PrivateEndpointConnectionPropertyInner; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnectionActionRequest; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnectionProperty; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointProperty; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateLinkServiceConnectionState; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateLinkServiceConnectionStateProperty; +import java.util.Collections; +import java.util.List; + +public final class PrivateEndpointConnectionPropertyImpl + implements PrivateEndpointConnectionProperty, + PrivateEndpointConnectionProperty.Definition, + PrivateEndpointConnectionProperty.Update { + private PrivateEndpointConnectionPropertyInner 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 PrivateEndpointProperty privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public List groupIds() { + List inner = this.innerModel().groupIds(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PrivateEndpointConnectionPropertyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String clusterName; + + private String privateEndpointConnectionName; + + private PrivateEndpointConnectionActionRequest createParameters; + + private PrivateEndpointConnectionActionRequest updateParameters; + + public PrivateEndpointConnectionPropertyImpl withExistingServerGroupsv2( + String resourceGroupName, String clusterName) { + this.resourceGroupName = resourceGroupName; + this.clusterName = clusterName; + return this; + } + + public PrivateEndpointConnectionProperty create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdateWithResponse( + resourceGroupName, clusterName, privateEndpointConnectionName, createParameters, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnectionProperty create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdateWithResponse( + resourceGroupName, clusterName, privateEndpointConnectionName, createParameters, context) + .getValue(); + return this; + } + + PrivateEndpointConnectionPropertyImpl( + String name, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionPropertyInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + this.createParameters = new PrivateEndpointConnectionActionRequest(); + } + + public PrivateEndpointConnectionPropertyImpl update() { + this.updateParameters = new PrivateEndpointConnectionActionRequest(); + return this; + } + + public PrivateEndpointConnectionProperty apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdateWithResponse( + resourceGroupName, clusterName, privateEndpointConnectionName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnectionProperty apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdateWithResponse( + resourceGroupName, clusterName, privateEndpointConnectionName, updateParameters, context) + .getValue(); + return this; + } + + PrivateEndpointConnectionPropertyImpl( + PrivateEndpointConnectionPropertyInner innerObject, + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.clusterName = Utils.getValueFromIdByName(innerObject.id(), "serverGroupsv2"); + this.privateEndpointConnectionName = Utils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public PrivateEndpointConnectionProperty refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, clusterName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnectionProperty refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, clusterName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionPropertyImpl withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + if (isInCreateMode()) { + this.createParameters.withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } else { + this.updateParameters.withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + 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/PrivateEndpointConnectionsClientImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 0000000000000..6a577b9d60e06 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,931 @@ +// 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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlhsc.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.PrivateEndpointConnectionPropertyInner; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnectionActionRequest; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnectionListResult; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnectionsCreateOrUpdateResponse; +import java.nio.ByteBuffer; +import java.util.UUID; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + /** The proxy service used to perform REST calls. */ + private final PrivateEndpointConnectionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBForPostgreSqlImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(CosmosDBForPostgreSqlImpl client) { + this.service = + RestProxy + .create( + PrivateEndpointConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBForPostgreSqlPrivateEndpointConnections to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBForPostgreSq") + public interface PrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCluster( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @BodyParam("application/json") PrivateEndpointConnectionActionRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets list of private endpoint connections on a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections on a cluster along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByClusterSinglePageAsync( + String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByCluster( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + 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())); + } + + /** + * Gets list of private endpoint connections on a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections on a cluster along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByClusterSinglePageAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCluster( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets list of private endpoint connections on a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections on a cluster as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByClusterAsync( + String resourceGroupName, String clusterName) { + return new PagedFlux<>(() -> listByClusterSinglePageAsync(resourceGroupName, clusterName)); + } + + /** + * Gets list of private endpoint connections on a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections on a cluster as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByClusterAsync( + String resourceGroupName, String clusterName, Context context) { + return new PagedFlux<>(() -> listByClusterSinglePageAsync(resourceGroupName, clusterName, context)); + } + + /** + * Gets list of private endpoint connections on a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections on a cluster as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCluster( + String resourceGroupName, String clusterName) { + return new PagedIterable<>(listByClusterAsync(resourceGroupName, clusterName)); + } + + /** + * Gets list of private endpoint connections on a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections on a cluster as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCluster( + String resourceGroupName, String clusterName, Context context) { + return new PagedIterable<>(listByClusterAsync(resourceGroupName, clusterName, context)); + } + + /** + * Gets private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String clusterName, String privateEndpointConnectionName) { + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName 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, + clusterName, + privateEndpointConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String clusterName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName 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, + clusterName, + privateEndpointConnectionName, + accept, + context); + } + + /** + * Gets private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String clusterName, String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, clusterName, privateEndpointConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String clusterName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, clusterName, privateEndpointConnectionName, context).block(); + } + + /** + * Gets private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionPropertyInner get( + String resourceGroupName, String clusterName, String privateEndpointConnectionName) { + return getWithResponse(resourceGroupName, clusterName, privateEndpointConnectionName, Context.NONE).getValue(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The required parameters for approving a private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection property on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionActionRequest 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + privateEndpointConnectionName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The required parameters for approving a private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection property on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionActionRequest 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + privateEndpointConnectionName, + parameters, + accept, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The required parameters for approving a private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection property on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionActionRequest parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, clusterName, privateEndpointConnectionName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The required parameters for approving a private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionsCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionActionRequest parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, clusterName, privateEndpointConnectionName, parameters, context) + .block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The required parameters for approving a private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionPropertyInner createOrUpdate( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionActionRequest parameters) { + return createOrUpdateWithResponse( + resourceGroupName, clusterName, privateEndpointConnectionName, parameters, Context.NONE) + .getValue(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String clusterName, String privateEndpointConnectionName) { + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName 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, + clusterName, + privateEndpointConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String clusterName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName 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, + clusterName, + privateEndpointConnectionName, + accept, + context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String clusterName, String privateEndpointConnectionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, clusterName, privateEndpointConnectionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String clusterName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, clusterName, privateEndpointConnectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, clusterName, privateEndpointConnectionName).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, clusterName, privateEndpointConnectionName, context).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String clusterName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, clusterName, privateEndpointConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String clusterName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, clusterName, privateEndpointConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String clusterName, String privateEndpointConnectionName) { + deleteAsync(resourceGroupName, clusterName, privateEndpointConnectionName).block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String clusterName, String privateEndpointConnectionName, Context context) { + deleteAsync(resourceGroupName, clusterName, privateEndpointConnectionName, context).block(); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateEndpointConnectionsImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..f41ee46c59622 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,215 @@ +// 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.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.PrivateEndpointConnectionPropertyInner; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnectionProperty; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnections; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionsImpl.class); + + private final PrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + public PrivateEndpointConnectionsImpl( + PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByCluster( + String resourceGroupName, String clusterName) { + PagedIterable inner = + this.serviceClient().listByCluster(resourceGroupName, clusterName); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionPropertyImpl(inner1, this.manager())); + } + + public PagedIterable listByCluster( + String resourceGroupName, String clusterName, Context context) { + PagedIterable inner = + this.serviceClient().listByCluster(resourceGroupName, clusterName, context); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionPropertyImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String clusterName, String privateEndpointConnectionName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, clusterName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateEndpointConnectionPropertyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateEndpointConnectionProperty get( + String resourceGroupName, String clusterName, String privateEndpointConnectionName) { + PrivateEndpointConnectionPropertyInner inner = + this.serviceClient().get(resourceGroupName, clusterName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionPropertyImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String clusterName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, clusterName, privateEndpointConnectionName); + } + + public void delete( + String resourceGroupName, String clusterName, String privateEndpointConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, clusterName, privateEndpointConnectionName, context); + } + + public PrivateEndpointConnectionProperty 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 clusterName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .getWithResponse(resourceGroupName, clusterName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this.getWithResponse(resourceGroupName, clusterName, privateEndpointConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, clusterName, privateEndpointConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'serverGroupsv2'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, clusterName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionPropertyImpl define(String name) { + return new PrivateEndpointConnectionPropertyImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateLinkResourceImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 0000000000000..bf432e3cb4c3a --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateLinkResourceImpl.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.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateLinkResource; +import java.util.Collections; +import java.util.List; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + PrivateLinkResourceImpl( + PrivateLinkResourceInner 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 groupId() { + return this.innerModel().groupId(); + } + + public List requiredMembers() { + List inner = this.innerModel().requiredMembers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List requiredZoneNames() { + List inner = this.innerModel().requiredZoneNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PrivateLinkResourceInner 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/PrivateLinkResourcesClientImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 0000000000000..b435378b1493c --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,420 @@ +// 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.resourcemanager.postgresqlhsc.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateLinkResourceListResult; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public final class PrivateLinkResourcesClientImpl implements PrivateLinkResourcesClient { + /** The proxy service used to perform REST calls. */ + private final PrivateLinkResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBForPostgreSqlImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(CosmosDBForPostgreSqlImpl client) { + this.service = + RestProxy + .create(PrivateLinkResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBForPostgreSqlPrivateLinkResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBForPostgreSq") + public interface PrivateLinkResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCluster( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/privateLinkResources/{privateLinkResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("privateLinkResourceName") String privateLinkResourceName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the private link resources for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for cluster along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByClusterSinglePageAsync( + String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByCluster( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + 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())); + } + + /** + * Gets the private link resources for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for cluster along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByClusterSinglePageAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCluster( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets the private link resources for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for cluster as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByClusterAsync(String resourceGroupName, String clusterName) { + return new PagedFlux<>(() -> listByClusterSinglePageAsync(resourceGroupName, clusterName)); + } + + /** + * Gets the private link resources for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for cluster as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByClusterAsync( + String resourceGroupName, String clusterName, Context context) { + return new PagedFlux<>(() -> listByClusterSinglePageAsync(resourceGroupName, clusterName, context)); + } + + /** + * Gets the private link resources for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for cluster as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCluster(String resourceGroupName, String clusterName) { + return new PagedIterable<>(listByClusterAsync(resourceGroupName, clusterName)); + } + + /** + * Gets the private link resources for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for cluster as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCluster( + String resourceGroupName, String clusterName, Context context) { + return new PagedIterable<>(listByClusterAsync(resourceGroupName, clusterName, context)); + } + + /** + * Gets a private link resource for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateLinkResourceName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String clusterName, String privateLinkResourceName) { + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (privateLinkResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter privateLinkResourceName 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, + clusterName, + privateLinkResourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a private link resource for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateLinkResourceName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String clusterName, String privateLinkResourceName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (privateLinkResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter privateLinkResourceName 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, + clusterName, + privateLinkResourceName, + accept, + context); + } + + /** + * Gets a private link resource for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateLinkResourceName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String clusterName, String privateLinkResourceName) { + return getWithResponseAsync(resourceGroupName, clusterName, privateLinkResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a private link resource for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateLinkResourceName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String clusterName, String privateLinkResourceName, Context context) { + return getWithResponseAsync(resourceGroupName, clusterName, privateLinkResourceName, context).block(); + } + + /** + * Gets a private link resource for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateLinkResourceName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner get(String resourceGroupName, String clusterName, String privateLinkResourceName) { + return getWithResponse(resourceGroupName, clusterName, privateLinkResourceName, Context.NONE).getValue(); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateLinkResourcesImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 0000000000000..85b197e54d97e --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.PrivateLinkResourcesClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateLinkResource; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateLinkResources; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkResourcesImpl.class); + + private final PrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + public PrivateLinkResourcesImpl( + PrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByCluster(String resourceGroupName, String clusterName) { + PagedIterable inner = + this.serviceClient().listByCluster(resourceGroupName, clusterName); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByCluster( + String resourceGroupName, String clusterName, Context context) { + PagedIterable inner = + this.serviceClient().listByCluster(resourceGroupName, clusterName, context); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String clusterName, String privateLinkResourceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, clusterName, privateLinkResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateLinkResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateLinkResource get(String resourceGroupName, String clusterName, String privateLinkResourceName) { + PrivateLinkResourceInner inner = + this.serviceClient().get(resourceGroupName, clusterName, privateLinkResourceName); + if (inner != null) { + return new PrivateLinkResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + private PrivateLinkResourcesClient 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..8bbe6efdf52be --- /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 clusterName; + + private String roleName; + + public RoleImpl withExistingServerGroupsv2(String resourceGroupName, String clusterName) { + this.resourceGroupName = resourceGroupName; + this.clusterName = clusterName; + return this; + } + + public Role create() { + this.innerObject = + serviceManager + .serviceClient() + .getRoles() + .create(resourceGroupName, clusterName, roleName, this.innerModel(), Context.NONE); + return this; + } + + public Role create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRoles() + .create(resourceGroupName, clusterName, 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..e5b9449c454a5 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/RolesClientImpl.java @@ -0,0 +1,809 @@ +// 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.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 java.util.UUID; +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 { + /** The proxy service used to perform REST calls. */ + private final RolesService service; + + /** The service client containing this operation class. */ + private final CosmosDBForPostgreSqlImpl client; + + /** + * Initializes an instance of RolesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RolesClientImpl(CosmosDBForPostgreSqlImpl client) { + this.service = RestProxy.create(RolesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBForPostgreSqlRoles to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBForPostgreSq") + public interface RolesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/roles/{roleName}") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @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/{clusterName}/roles/{roleName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("roleName") String roleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/roles") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCluster( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @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 clusterName The name of the cluster. + * @param roleName The name of the cluster role. + * @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 cluster role along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + 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 clusterName The name of the cluster. + * @param roleName The name of the cluster role. + * @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 cluster role along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + 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 clusterName The name of the cluster. + * @param roleName The name of the cluster role. + * @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 the {@link PollerFlux} for polling of represents a cluster role. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RoleInner> beginCreateAsync( + String resourceGroupName, String clusterName, String roleName, RoleInner parameters) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, clusterName, 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 clusterName The name of the cluster. + * @param roleName The name of the cluster role. + * @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 the {@link PollerFlux} for polling of represents a cluster role. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RoleInner> beginCreateAsync( + String resourceGroupName, String clusterName, String roleName, RoleInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, clusterName, 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 clusterName The name of the cluster. + * @param roleName The name of the cluster role. + * @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 the {@link SyncPoller} for polling of represents a cluster role. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RoleInner> beginCreate( + String resourceGroupName, String clusterName, String roleName, RoleInner parameters) { + return beginCreateAsync(resourceGroupName, clusterName, 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 clusterName The name of the cluster. + * @param roleName The name of the cluster role. + * @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 the {@link SyncPoller} for polling of represents a cluster role. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RoleInner> beginCreate( + String resourceGroupName, String clusterName, String roleName, RoleInner parameters, Context context) { + return beginCreateAsync(resourceGroupName, clusterName, 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 clusterName The name of the cluster. + * @param roleName The name of the cluster role. + * @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 cluster role on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String clusterName, String roleName, RoleInner parameters) { + return beginCreateAsync(resourceGroupName, clusterName, 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 clusterName The name of the cluster. + * @param roleName The name of the cluster role. + * @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 cluster role on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String clusterName, String roleName, RoleInner parameters, Context context) { + return beginCreateAsync(resourceGroupName, clusterName, 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 clusterName The name of the cluster. + * @param roleName The name of the cluster role. + * @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 cluster role. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleInner create(String resourceGroupName, String clusterName, String roleName, RoleInner parameters) { + return createAsync(resourceGroupName, clusterName, 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 clusterName The name of the cluster. + * @param roleName The name of the cluster role. + * @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 cluster role. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleInner create( + String resourceGroupName, String clusterName, String roleName, RoleInner parameters, Context context) { + return createAsync(resourceGroupName, clusterName, roleName, parameters, context).block(); + } + + /** + * Deletes a cluster role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param roleName The name of the cluster 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + roleName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a cluster role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param roleName The name of the cluster 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + roleName, + accept, + context); + } + + /** + * Deletes a cluster role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param roleName The name of the cluster 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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String clusterName, String roleName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, clusterName, roleName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a cluster role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param roleName The name of the cluster 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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String clusterName, String roleName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, clusterName, roleName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a cluster role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param roleName The name of the cluster 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, String roleName) { + return beginDeleteAsync(resourceGroupName, clusterName, roleName).getSyncPoller(); + } + + /** + * Deletes a cluster role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param roleName The name of the cluster 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, String roleName, Context context) { + return beginDeleteAsync(resourceGroupName, clusterName, roleName, context).getSyncPoller(); + } + + /** + * Deletes a cluster role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param roleName The name of the cluster 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String clusterName, String roleName) { + return beginDeleteAsync(resourceGroupName, clusterName, roleName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a cluster role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param roleName The name of the cluster 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String clusterName, String roleName, Context context) { + return beginDeleteAsync(resourceGroupName, clusterName, roleName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a cluster role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param roleName The name of the cluster 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String clusterName, String roleName) { + deleteAsync(resourceGroupName, clusterName, roleName).block(); + } + + /** + * Deletes a cluster role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param roleName The name of the cluster 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String clusterName, String roleName, Context context) { + deleteAsync(resourceGroupName, clusterName, roleName, context).block(); + } + + /** + * List all the roles in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByClusterSinglePageAsync(String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByCluster( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + 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 cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByClusterSinglePageAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCluster( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the roles in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByClusterAsync(String resourceGroupName, String clusterName) { + return new PagedFlux<>(() -> listByClusterSinglePageAsync(resourceGroupName, clusterName)); + } + + /** + * List all the roles in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByClusterAsync(String resourceGroupName, String clusterName, Context context) { + return new PagedFlux<>(() -> listByClusterSinglePageAsync(resourceGroupName, clusterName, context)); + } + + /** + * List all the roles in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCluster(String resourceGroupName, String clusterName) { + return new PagedIterable<>(listByClusterAsync(resourceGroupName, clusterName)); + } + + /** + * List all the roles in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCluster(String resourceGroupName, String clusterName, Context context) { + return new PagedIterable<>(listByClusterAsync(resourceGroupName, clusterName, 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..6b9520d10f9b2 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/RolesImpl.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + +public final class RolesImpl implements Roles { + private static 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 clusterName, String roleName) { + this.serviceClient().delete(resourceGroupName, clusterName, roleName); + } + + public void delete(String resourceGroupName, String clusterName, String roleName, Context context) { + this.serviceClient().delete(resourceGroupName, clusterName, roleName, context); + } + + public PagedIterable listByCluster(String resourceGroupName, String clusterName) { + PagedIterable inner = this.serviceClient().listByCluster(resourceGroupName, clusterName); + return Utils.mapPage(inner, inner1 -> new RoleImpl(inner1, this.manager())); + } + + public PagedIterable listByCluster(String resourceGroupName, String clusterName, Context context) { + PagedIterable inner = this.serviceClient().listByCluster(resourceGroupName, clusterName, 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 clusterName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (clusterName == 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, clusterName, 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 clusterName = Utils.getValueFromIdByName(id, "serverGroupsv2"); + if (clusterName == 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, clusterName, 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..17faaab163b14 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerConfigurationImpl.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.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 Boolean requiresRestart() { + return this.innerModel().requiresRestart(); + } + + 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/ServersClientImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServersClientImpl.java new file mode 100644 index 0000000000000..2a6ed11a5d87c --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServersClientImpl.java @@ -0,0 +1,413 @@ +// 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.resourcemanager.postgresqlhsc.fluent.ServersClient; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ClusterServerInner; +import com.azure.resourcemanager.postgresqlhsc.models.ClusterServerListResult; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServersClient. */ +public final class ServersClientImpl implements ServersClient { + /** The proxy service used to perform REST calls. */ + private final ServersService service; + + /** The service client containing this operation class. */ + private final CosmosDBForPostgreSqlImpl client; + + /** + * Initializes an instance of ServersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServersClientImpl(CosmosDBForPostgreSqlImpl client) { + this.service = RestProxy.create(ServersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBForPostgreSqlServers to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBForPostgreSq") + public interface ServersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/servers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCluster( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/serverGroupsv2/{clusterName}/servers/{serverName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") UUID subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists servers of a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 cluster along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByClusterSinglePageAsync( + String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByCluster( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + 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 cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 cluster along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByClusterSinglePageAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCluster( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists servers of a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 cluster as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByClusterAsync(String resourceGroupName, String clusterName) { + return new PagedFlux<>(() -> listByClusterSinglePageAsync(resourceGroupName, clusterName)); + } + + /** + * Lists servers of a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 cluster as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByClusterAsync( + String resourceGroupName, String clusterName, Context context) { + return new PagedFlux<>(() -> listByClusterSinglePageAsync(resourceGroupName, clusterName, context)); + } + + /** + * Lists servers of a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 cluster as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCluster(String resourceGroupName, String clusterName) { + return new PagedIterable<>(listByClusterAsync(resourceGroupName, clusterName)); + } + + /** + * Lists servers of a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 cluster as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCluster( + String resourceGroupName, String clusterName, Context context) { + return new PagedIterable<>(listByClusterAsync(resourceGroupName, clusterName, context)); + } + + /** + * Gets information about a server in cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @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 cluster along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + serverName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about a server in cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @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 cluster along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + serverName, + accept, + context); + } + + /** + * Gets information about a server in cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @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 cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String clusterName, String serverName) { + return getWithResponseAsync(resourceGroupName, clusterName, serverName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets information about a server in cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @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 cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String clusterName, String serverName, Context context) { + return getWithResponseAsync(resourceGroupName, clusterName, serverName, context).block(); + } + + /** + * Gets information about a server in cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @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 cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterServerInner get(String resourceGroupName, String clusterName, String serverName) { + return getWithResponse(resourceGroupName, clusterName, serverName, Context.NONE).getValue(); + } +} 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..dd9af98f2ff60 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServersImpl.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.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.ClusterServerInner; +import com.azure.resourcemanager.postgresqlhsc.models.ClusterServer; +import com.azure.resourcemanager.postgresqlhsc.models.Servers; + +public final class ServersImpl implements Servers { + private static final ClientLogger LOGGER = new ClientLogger(ServersImpl.class); + + private final ServersClient innerClient; + + private final com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager; + + public ServersImpl( + ServersClient innerClient, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByCluster(String resourceGroupName, String clusterName) { + PagedIterable inner = this.serviceClient().listByCluster(resourceGroupName, clusterName); + return Utils.mapPage(inner, inner1 -> new ClusterServerImpl(inner1, this.manager())); + } + + public PagedIterable listByCluster(String resourceGroupName, String clusterName, Context context) { + PagedIterable inner = + this.serviceClient().listByCluster(resourceGroupName, clusterName, context); + return Utils.mapPage(inner, inner1 -> new ClusterServerImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String clusterName, String serverName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, clusterName, serverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ClusterServerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ClusterServer get(String resourceGroupName, String clusterName, String serverName) { + ClusterServerInner inner = this.serviceClient().get(resourceGroupName, clusterName, serverName); + if (inner != null) { + return new ClusterServerImpl(inner, 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..893c34d4cb607 --- /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 CosmosDBForPostgreSql. The Microsoft Azure management API provides create, + * read, update, and delete functionality for Cosmos DB for PostgreSQL resources including clusters, servers, + * configurations, firewall rules, roles, private endpoint connections and private link resources. + */ +package com.azure.resourcemanager.postgresqlhsc.implementation; diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Cluster.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Cluster.java new file mode 100644 index 0000000000000..cbb211a8dd8e3 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Cluster.java @@ -0,0 +1,547 @@ +// 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.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ClusterProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** Represents a cluster for create. */ +@Fluent +public final class Cluster extends ProxyResource { + /* + * Properties of the cluster create. + */ + @JsonProperty(value = "properties") + private ClusterProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The geo-location where the resource lives + */ + @JsonProperty(value = "location") + private String location; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of Cluster class. */ + public Cluster() { + } + + /** + * Get the innerProperties property: Properties of the cluster create. + * + * @return the innerProperties value. + */ + private ClusterProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the Cluster object itself. + */ + public Cluster withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geo-location where the resource lives. + * + * @param location the location value to set. + * @return the Cluster object itself. + */ + public Cluster withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the administratorLoginPassword property: The password of the administrator login. Required for creation. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.innerProperties() == null ? null : this.innerProperties().administratorLoginPassword(); + } + + /** + * Set the administratorLoginPassword property: The password of the administrator login. Required for creation. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the Cluster object itself. + */ + public Cluster withAdministratorLoginPassword(String administratorLoginPassword) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + /** + * Get the postgresqlVersion property: The PostgreSQL version of cluster. + * + * @return the postgresqlVersion value. + */ + public String postgresqlVersion() { + return this.innerProperties() == null ? null : this.innerProperties().postgresqlVersion(); + } + + /** + * Set the postgresqlVersion property: The PostgreSQL version of cluster. + * + * @param postgresqlVersion the postgresqlVersion value to set. + * @return the Cluster object itself. + */ + public Cluster withPostgresqlVersion(String postgresqlVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withPostgresqlVersion(postgresqlVersion); + return this; + } + + /** + * Get the citusVersion property: The Citus version of cluster. + * + * @return the citusVersion value. + */ + public String citusVersion() { + return this.innerProperties() == null ? null : this.innerProperties().citusVersion(); + } + + /** + * Set the citusVersion property: The Citus version of cluster. + * + * @param citusVersion the citusVersion value to set. + * @return the Cluster object itself. + */ + public Cluster withCitusVersion(String citusVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withCitusVersion(citusVersion); + return this; + } + + /** + * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * + * @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 cluster. + * + * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. + * @return the Cluster object itself. + */ + public Cluster withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withEnableShardsOnCoordinator(enableShardsOnCoordinator); + return this; + } + + /** + * Get the earliestRestoreTime property: The earliest restore point time (ISO8601 format) for the cluster. + * + * @return the earliestRestoreTime value. + */ + public OffsetDateTime earliestRestoreTime() { + return this.innerProperties() == null ? null : this.innerProperties().earliestRestoreTime(); + } + + /** + * Get the enableHa property: If high availability is enabled or not for the cluster. + * + * @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 cluster. + * + * @param enableHa the enableHa value to set. + * @return the Cluster object itself. + */ + public Cluster withEnableHa(Boolean enableHa) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withEnableHa(enableHa); + return this; + } + + /** + * Get the preferredPrimaryZone property: Preferred primary zone for the cluster. + * + * @return the preferredPrimaryZone value. + */ + public String preferredPrimaryZone() { + return this.innerProperties() == null ? null : this.innerProperties().preferredPrimaryZone(); + } + + /** + * Set the preferredPrimaryZone property: Preferred primary zone for the cluster. + * + * @param preferredPrimaryZone the preferredPrimaryZone value to set. + * @return the Cluster object itself. + */ + public Cluster withPreferredPrimaryZone(String preferredPrimaryZone) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withPreferredPrimaryZone(preferredPrimaryZone); + return this; + } + + /** + * Get the coordinatorServerEdition property: The edition of the coordinator (default: GeneralPurpose). Required for + * creation. + * + * @return the coordinatorServerEdition value. + */ + public String coordinatorServerEdition() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorServerEdition(); + } + + /** + * Set the coordinatorServerEdition property: The edition of the coordinator (default: GeneralPurpose). Required for + * creation. + * + * @param coordinatorServerEdition the coordinatorServerEdition value to set. + * @return the Cluster object itself. + */ + public Cluster withCoordinatorServerEdition(String coordinatorServerEdition) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withCoordinatorServerEdition(coordinatorServerEdition); + return this; + } + + /** + * Get the coordinatorStorageQuotaInMb property: The storage of the coordinator in MB. Required for creation. + * + * @return the coordinatorStorageQuotaInMb value. + */ + public Long coordinatorStorageQuotaInMb() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorStorageQuotaInMb(); + } + + /** + * Set the coordinatorStorageQuotaInMb property: The storage of the coordinator in MB. Required for creation. + * + * @param coordinatorStorageQuotaInMb the coordinatorStorageQuotaInMb value to set. + * @return the Cluster object itself. + */ + public Cluster withCoordinatorStorageQuotaInMb(Long coordinatorStorageQuotaInMb) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withCoordinatorStorageQuotaInMb(coordinatorStorageQuotaInMb); + return this; + } + + /** + * Get the coordinatorVCores property: The vCores count of the coordinator (max: 64). Required for creation. + * + * @return the coordinatorVCores value. + */ + public Long coordinatorVCores() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorVCores(); + } + + /** + * Set the coordinatorVCores property: The vCores count of the coordinator (max: 64). Required for creation. + * + * @param coordinatorVCores the coordinatorVCores value to set. + * @return the Cluster object itself. + */ + public Cluster withCoordinatorVCores(Long coordinatorVCores) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withCoordinatorVCores(coordinatorVCores); + return this; + } + + /** + * Get the coordinatorEnablePublicIpAccess property: If public IP is requested or not for the coordinator. + * + * @return the coordinatorEnablePublicIpAccess value. + */ + public Boolean coordinatorEnablePublicIpAccess() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorEnablePublicIpAccess(); + } + + /** + * Set the coordinatorEnablePublicIpAccess property: If public IP is requested or not for the coordinator. + * + * @param coordinatorEnablePublicIpAccess the coordinatorEnablePublicIpAccess value to set. + * @return the Cluster object itself. + */ + public Cluster withCoordinatorEnablePublicIpAccess(Boolean coordinatorEnablePublicIpAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withCoordinatorEnablePublicIpAccess(coordinatorEnablePublicIpAccess); + return this; + } + + /** + * Get the nodeServerEdition property: The edition of a node (default: MemoryOptimized). + * + * @return the nodeServerEdition value. + */ + public String nodeServerEdition() { + return this.innerProperties() == null ? null : this.innerProperties().nodeServerEdition(); + } + + /** + * Set the nodeServerEdition property: The edition of a node (default: MemoryOptimized). + * + * @param nodeServerEdition the nodeServerEdition value to set. + * @return the Cluster object itself. + */ + public Cluster withNodeServerEdition(String nodeServerEdition) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withNodeServerEdition(nodeServerEdition); + return this; + } + + /** + * Get the nodeCount property: Worker node count of the cluster. When node count is 0, it represents a coordinator + * with the ability to create distributed tables on that node. Node count value can not be 1. + * + * @return the nodeCount value. + */ + public Long nodeCount() { + return this.innerProperties() == null ? null : this.innerProperties().nodeCount(); + } + + /** + * Set the nodeCount property: Worker node count of the cluster. When node count is 0, it represents a coordinator + * with the ability to create distributed tables on that node. Node count value can not be 1. + * + * @param nodeCount the nodeCount value to set. + * @return the Cluster object itself. + */ + public Cluster withNodeCount(Long nodeCount) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withNodeCount(nodeCount); + return this; + } + + /** + * Get the nodeStorageQuotaInMb property: The storage of a node in MB. + * + * @return the nodeStorageQuotaInMb value. + */ + public Long nodeStorageQuotaInMb() { + return this.innerProperties() == null ? null : this.innerProperties().nodeStorageQuotaInMb(); + } + + /** + * Set the nodeStorageQuotaInMb property: The storage of a node in MB. + * + * @param nodeStorageQuotaInMb the nodeStorageQuotaInMb value to set. + * @return the Cluster object itself. + */ + public Cluster withNodeStorageQuotaInMb(Long nodeStorageQuotaInMb) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withNodeStorageQuotaInMb(nodeStorageQuotaInMb); + return this; + } + + /** + * Get the nodeVCores property: The vCores count of a node (max: 64). + * + * @return the nodeVCores value. + */ + public Long nodeVCores() { + return this.innerProperties() == null ? null : this.innerProperties().nodeVCores(); + } + + /** + * Set the nodeVCores property: The vCores count of a node (max: 64). + * + * @param nodeVCores the nodeVCores value to set. + * @return the Cluster object itself. + */ + public Cluster withNodeVCores(Long nodeVCores) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withNodeVCores(nodeVCores); + return this; + } + + /** + * Get the nodeEnablePublicIpAccess property: If public IP is requested or not for a node. + * + * @return the nodeEnablePublicIpAccess value. + */ + public Boolean nodeEnablePublicIpAccess() { + return this.innerProperties() == null ? null : this.innerProperties().nodeEnablePublicIpAccess(); + } + + /** + * Set the nodeEnablePublicIpAccess property: If public IP is requested or not for a node. + * + * @param nodeEnablePublicIpAccess the nodeEnablePublicIpAccess value to set. + * @return the Cluster object itself. + */ + public Cluster withNodeEnablePublicIpAccess(Boolean nodeEnablePublicIpAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withNodeEnablePublicIpAccess(nodeEnablePublicIpAccess); + return this; + } + + /** + * Get the maintenanceWindow property: Maintenance window of a cluster. + * + * @return the maintenanceWindow value. + */ + public MaintenanceWindow maintenanceWindow() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceWindow(); + } + + /** + * Set the maintenanceWindow property: Maintenance window of a cluster. + * + * @param maintenanceWindow the maintenanceWindow value to set. + * @return the Cluster object itself. + */ + public Cluster withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withMaintenanceWindow(maintenanceWindow); + return this; + } + + /** + * Get the sourceResourceId property: The source resource id to restore from. It's required for 'PointInTimeRestore' + * or 'ReadReplica' operations. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceResourceId(); + } + + /** + * Set the sourceResourceId property: The source resource id to restore from. It's required for 'PointInTimeRestore' + * or 'ReadReplica' operations. + * + * @param sourceResourceId the sourceResourceId value to set. + * @return the Cluster object itself. + */ + public Cluster withSourceResourceId(String sourceResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withSourceResourceId(sourceResourceId); + return this; + } + + /** + * Get the sourceLocation property: The source cluster location to restore from. It's required for + * 'PointInTimeRestore' or 'ReadReplica' operations. + * + * @return the sourceLocation value. + */ + public String sourceLocation() { + return this.innerProperties() == null ? null : this.innerProperties().sourceLocation(); + } + + /** + * Set the sourceLocation property: The source cluster location to restore from. It's required for + * 'PointInTimeRestore' or 'ReadReplica' operations. + * + * @param sourceLocation the sourceLocation value to set. + * @return the Cluster object itself. + */ + public Cluster withSourceLocation(String sourceLocation) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withSourceLocation(sourceLocation); + 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/ClusterConfigurationListResult.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterConfigurationListResult.java new file mode 100644 index 0000000000000..8f3dfcee6c3fa --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterConfigurationListResult.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.resourcemanager.postgresqlhsc.fluent.models.ConfigurationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of cluster configurations. */ +@Fluent +public final class ClusterConfigurationListResult { + /* + * The list of cluster 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; + + /** Creates an instance of ClusterConfigurationListResult class. */ + public ClusterConfigurationListResult() { + } + + /** + * Get the value property: The list of cluster configurations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of cluster configurations. + * + * @param value the value value to set. + * @return the ClusterConfigurationListResult object itself. + */ + public ClusterConfigurationListResult 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/ClusterForUpdate.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterForUpdate.java new file mode 100644 index 0000000000000..eea1793485c2e --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterForUpdate.java @@ -0,0 +1,428 @@ +// 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.resourcemanager.postgresqlhsc.fluent.models.ClusterPropertiesForUpdate; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Represents a cluster for update. */ +@Fluent +public final class ClusterForUpdate { + /* + * Properties of the cluster. + */ + @JsonProperty(value = "properties") + private ClusterPropertiesForUpdate innerProperties; + + /* + * Application-specific metadata in the form of key-value pairs. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of ClusterForUpdate class. */ + public ClusterForUpdate() { + } + + /** + * Get the innerProperties property: Properties of the cluster. + * + * @return the innerProperties value. + */ + private ClusterPropertiesForUpdate 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 ClusterForUpdate object itself. + */ + public ClusterForUpdate 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 ClusterForUpdate object itself. + */ + public ClusterForUpdate withAdministratorLoginPassword(String administratorLoginPassword) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + /** + * Get the postgresqlVersion property: The PostgreSQL version of the cluster. + * + * @return the postgresqlVersion value. + */ + public String postgresqlVersion() { + return this.innerProperties() == null ? null : this.innerProperties().postgresqlVersion(); + } + + /** + * Set the postgresqlVersion property: The PostgreSQL version of the cluster. + * + * @param postgresqlVersion the postgresqlVersion value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withPostgresqlVersion(String postgresqlVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withPostgresqlVersion(postgresqlVersion); + return this; + } + + /** + * Get the citusVersion property: The Citus version of the cluster. + * + * @return the citusVersion value. + */ + public String citusVersion() { + return this.innerProperties() == null ? null : this.innerProperties().citusVersion(); + } + + /** + * Set the citusVersion property: The Citus version of the cluster. + * + * @param citusVersion the citusVersion value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withCitusVersion(String citusVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withCitusVersion(citusVersion); + return this; + } + + /** + * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * + * @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 cluster. + * + * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withEnableShardsOnCoordinator(enableShardsOnCoordinator); + return this; + } + + /** + * Get the enableHa property: If high availability is enabled or not for the cluster. + * + * @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 cluster. + * + * @param enableHa the enableHa value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withEnableHa(Boolean enableHa) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withEnableHa(enableHa); + return this; + } + + /** + * Get the preferredPrimaryZone property: Preferred primary zone for the cluster. + * + * @return the preferredPrimaryZone value. + */ + public String preferredPrimaryZone() { + return this.innerProperties() == null ? null : this.innerProperties().preferredPrimaryZone(); + } + + /** + * Set the preferredPrimaryZone property: Preferred primary zone for the cluster. + * + * @param preferredPrimaryZone the preferredPrimaryZone value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withPreferredPrimaryZone(String preferredPrimaryZone) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withPreferredPrimaryZone(preferredPrimaryZone); + return this; + } + + /** + * Get the coordinatorServerEdition property: The edition of the coordinator (default: GeneralPurpose). + * + * @return the coordinatorServerEdition value. + */ + public String coordinatorServerEdition() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorServerEdition(); + } + + /** + * Set the coordinatorServerEdition property: The edition of the coordinator (default: GeneralPurpose). + * + * @param coordinatorServerEdition the coordinatorServerEdition value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withCoordinatorServerEdition(String coordinatorServerEdition) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withCoordinatorServerEdition(coordinatorServerEdition); + return this; + } + + /** + * Get the coordinatorStorageQuotaInMb property: The storage of the coordinator in MB. + * + * @return the coordinatorStorageQuotaInMb value. + */ + public Long coordinatorStorageQuotaInMb() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorStorageQuotaInMb(); + } + + /** + * Set the coordinatorStorageQuotaInMb property: The storage of the coordinator in MB. + * + * @param coordinatorStorageQuotaInMb the coordinatorStorageQuotaInMb value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withCoordinatorStorageQuotaInMb(Long coordinatorStorageQuotaInMb) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withCoordinatorStorageQuotaInMb(coordinatorStorageQuotaInMb); + return this; + } + + /** + * Get the coordinatorVCores property: The vCores count of the coordinator (max: 64). + * + * @return the coordinatorVCores value. + */ + public Long coordinatorVCores() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorVCores(); + } + + /** + * Set the coordinatorVCores property: The vCores count of the coordinator (max: 64). + * + * @param coordinatorVCores the coordinatorVCores value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withCoordinatorVCores(Long coordinatorVCores) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withCoordinatorVCores(coordinatorVCores); + return this; + } + + /** + * Get the coordinatorEnablePublicIpAccess property: If public IP is requested or not for the coordinator. + * + * @return the coordinatorEnablePublicIpAccess value. + */ + public Boolean coordinatorEnablePublicIpAccess() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorEnablePublicIpAccess(); + } + + /** + * Set the coordinatorEnablePublicIpAccess property: If public IP is requested or not for the coordinator. + * + * @param coordinatorEnablePublicIpAccess the coordinatorEnablePublicIpAccess value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withCoordinatorEnablePublicIpAccess(Boolean coordinatorEnablePublicIpAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withCoordinatorEnablePublicIpAccess(coordinatorEnablePublicIpAccess); + return this; + } + + /** + * Get the nodeServerEdition property: The edition of a node (default: MemoryOptimized). + * + * @return the nodeServerEdition value. + */ + public String nodeServerEdition() { + return this.innerProperties() == null ? null : this.innerProperties().nodeServerEdition(); + } + + /** + * Set the nodeServerEdition property: The edition of a node (default: MemoryOptimized). + * + * @param nodeServerEdition the nodeServerEdition value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withNodeServerEdition(String nodeServerEdition) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withNodeServerEdition(nodeServerEdition); + return this; + } + + /** + * Get the nodeCount property: Worker node count of the cluster. When node count is 0, it represents a coordinator + * with the ability to create distributed tables on that node. Node count value can not be 1. + * + * @return the nodeCount value. + */ + public Long nodeCount() { + return this.innerProperties() == null ? null : this.innerProperties().nodeCount(); + } + + /** + * Set the nodeCount property: Worker node count of the cluster. When node count is 0, it represents a coordinator + * with the ability to create distributed tables on that node. Node count value can not be 1. + * + * @param nodeCount the nodeCount value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withNodeCount(Long nodeCount) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withNodeCount(nodeCount); + return this; + } + + /** + * Get the nodeStorageQuotaInMb property: The storage of a node in MB. + * + * @return the nodeStorageQuotaInMb value. + */ + public Long nodeStorageQuotaInMb() { + return this.innerProperties() == null ? null : this.innerProperties().nodeStorageQuotaInMb(); + } + + /** + * Set the nodeStorageQuotaInMb property: The storage of a node in MB. + * + * @param nodeStorageQuotaInMb the nodeStorageQuotaInMb value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withNodeStorageQuotaInMb(Long nodeStorageQuotaInMb) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withNodeStorageQuotaInMb(nodeStorageQuotaInMb); + return this; + } + + /** + * Get the nodeVCores property: The vCores count of a node (max: 64). + * + * @return the nodeVCores value. + */ + public Long nodeVCores() { + return this.innerProperties() == null ? null : this.innerProperties().nodeVCores(); + } + + /** + * Set the nodeVCores property: The vCores count of a node (max: 64). + * + * @param nodeVCores the nodeVCores value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withNodeVCores(Long nodeVCores) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withNodeVCores(nodeVCores); + return this; + } + + /** + * Get the nodeEnablePublicIpAccess property: If public IP is requested or not for a node. + * + * @return the nodeEnablePublicIpAccess value. + */ + public Boolean nodeEnablePublicIpAccess() { + return this.innerProperties() == null ? null : this.innerProperties().nodeEnablePublicIpAccess(); + } + + /** + * Get the maintenanceWindow property: Maintenance window of a cluster. + * + * @return the maintenanceWindow value. + */ + public MaintenanceWindow maintenanceWindow() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceWindow(); + } + + /** + * Set the maintenanceWindow property: Maintenance window of a cluster. + * + * @param maintenanceWindow the maintenanceWindow value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withMaintenanceWindow(maintenanceWindow); + 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/ClusterListResult.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterListResult.java new file mode 100644 index 0000000000000..11a2e30c76453 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterListResult.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.resourcemanager.postgresqlhsc.fluent.models.ClusterResponseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of clusters. */ +@Fluent +public final class ClusterListResult { + /* + * The list of clusters + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link used to get the next page of cluster list. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ClusterListResult class. */ + public ClusterListResult() { + } + + /** + * Get the value property: The list of clusters. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of clusters. + * + * @param value the value value to set. + * @return the ClusterListResult object itself. + */ + public ClusterListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link used to get the next page of cluster list. + * + * @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/ClusterResponse.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterResponse.java new file mode 100644 index 0000000000000..11dd75f7ee580 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterResponse.java @@ -0,0 +1,830 @@ +// 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.ClusterResponseInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ClusterResponse. */ +public interface ClusterResponse { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the administratorLogin property: The administrator's login name of the servers in the cluster. + * + * @return the administratorLogin value. + */ + String administratorLogin(); + + /** + * Gets the provisioningState property: Provisioning state of the cluster. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the state property: A state of a cluster/server that is visible to user. + * + * @return the state value. + */ + String state(); + + /** + * Gets the postgresqlVersion property: The PostgreSQL version of cluster. + * + * @return the postgresqlVersion value. + */ + String postgresqlVersion(); + + /** + * Gets the citusVersion property: The Citus version of cluster. + * + * @return the citusVersion value. + */ + String citusVersion(); + + /** + * Gets the maintenanceWindow property: Maintenance window of a cluster. + * + * @return the maintenanceWindow value. + */ + MaintenanceWindow maintenanceWindow(); + + /** + * Gets the preferredPrimaryZone property: Preferred primary zone for the cluster. + * + * @return the preferredPrimaryZone value. + */ + String preferredPrimaryZone(); + + /** + * Gets the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * + * @return the enableShardsOnCoordinator value. + */ + Boolean enableShardsOnCoordinator(); + + /** + * Gets the enableHa property: If high availability is enabled or not for the server. + * + * @return the enableHa value. + */ + Boolean enableHa(); + + /** + * Gets the coordinatorServerEdition property: The edition of a coordinator server (default: GeneralPurpose). + * + * @return the coordinatorServerEdition value. + */ + String coordinatorServerEdition(); + + /** + * Gets the coordinatorStorageQuotaInMb property: The storage of a server in MB. + * + * @return the coordinatorStorageQuotaInMb value. + */ + Long coordinatorStorageQuotaInMb(); + + /** + * Gets the coordinatorVCores property: The vCores count of a server (max: 64). + * + * @return the coordinatorVCores value. + */ + Long coordinatorVCores(); + + /** + * Gets the coordinatorEnablePublicIpAccess property: If public IP is requested or not for a server. + * + * @return the coordinatorEnablePublicIpAccess value. + */ + Boolean coordinatorEnablePublicIpAccess(); + + /** + * Gets the nodeServerEdition property: The edition of a node server (default: MemoryOptimized). + * + * @return the nodeServerEdition value. + */ + String nodeServerEdition(); + + /** + * Gets the nodeCount property: Worker node count of the cluster. + * + * @return the nodeCount value. + */ + Long nodeCount(); + + /** + * Gets the nodeStorageQuotaInMb property: The storage of a server in MB. + * + * @return the nodeStorageQuotaInMb value. + */ + Long nodeStorageQuotaInMb(); + + /** + * Gets the nodeVCores property: The vCores count of a server (max: 64). + * + * @return the nodeVCores value. + */ + Long nodeVCores(); + + /** + * Gets the nodeEnablePublicIpAccess property: If public IP is requested or not for a server. + * + * @return the nodeEnablePublicIpAccess value. + */ + Boolean nodeEnablePublicIpAccess(); + + /** + * Gets the serverNames property: The list of server names in the cluster. + * + * @return the serverNames value. + */ + List serverNames(); + + /** + * Gets the sourceResourceId property: The resource id of source cluster for read replica clusters. + * + * @return the sourceResourceId value. + */ + String sourceResourceId(); + + /** + * Gets the sourceLocation property: The location of source cluster for read replica clusters. + * + * @return the sourceLocation value. + */ + String sourceLocation(); + + /** + * Gets the readReplicas property: The array of read replica clusters. + * + * @return the readReplicas value. + */ + List readReplicas(); + + /** + * Gets the earliestRestoreTime property: The earliest restore point time (ISO8601 format) for the cluster. + * + * @return the earliestRestoreTime value. + */ + OffsetDateTime earliestRestoreTime(); + + /** + * Gets the privateEndpointConnections property: The private endpoint connections for a cluster. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlhsc.fluent.models.ClusterResponseInner object. + * + * @return the inner object. + */ + ClusterResponseInner innerModel(); + + /** The entirety of the ClusterResponse definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + /** The ClusterResponse definition stages. */ + interface DefinitionStages { + /** The first stage of the ClusterResponse definition. */ + interface Blank extends WithResourceGroup { + } + /** The stage of the ClusterResponse 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 ClusterResponse 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.WithLocation, + DefinitionStages.WithTags, + DefinitionStages.WithAdministratorLoginPassword, + DefinitionStages.WithPostgresqlVersion, + DefinitionStages.WithCitusVersion, + DefinitionStages.WithEnableShardsOnCoordinator, + DefinitionStages.WithEnableHa, + DefinitionStages.WithPreferredPrimaryZone, + DefinitionStages.WithCoordinatorServerEdition, + DefinitionStages.WithCoordinatorStorageQuotaInMb, + DefinitionStages.WithCoordinatorVCores, + DefinitionStages.WithCoordinatorEnablePublicIpAccess, + DefinitionStages.WithNodeServerEdition, + DefinitionStages.WithNodeCount, + DefinitionStages.WithNodeStorageQuotaInMb, + DefinitionStages.WithNodeVCores, + DefinitionStages.WithNodeEnablePublicIpAccess, + DefinitionStages.WithMaintenanceWindow, + DefinitionStages.WithSourceResourceId, + DefinitionStages.WithSourceLocation { + /** + * Executes the create request. + * + * @return the created resource. + */ + ClusterResponse create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ClusterResponse create(Context context); + } + /** The stage of the ClusterResponse 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. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + /** The stage of the ClusterResponse 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 ClusterResponse definition allowing to specify administratorLoginPassword. */ + interface WithAdministratorLoginPassword { + /** + * Specifies the administratorLoginPassword property: The password of the administrator login. Required for + * creation.. + * + * @param administratorLoginPassword The password of the administrator login. Required for creation. + * @return the next definition stage. + */ + WithCreate withAdministratorLoginPassword(String administratorLoginPassword); + } + /** The stage of the ClusterResponse definition allowing to specify postgresqlVersion. */ + interface WithPostgresqlVersion { + /** + * Specifies the postgresqlVersion property: The PostgreSQL version of cluster.. + * + * @param postgresqlVersion The PostgreSQL version of cluster. + * @return the next definition stage. + */ + WithCreate withPostgresqlVersion(String postgresqlVersion); + } + /** The stage of the ClusterResponse definition allowing to specify citusVersion. */ + interface WithCitusVersion { + /** + * Specifies the citusVersion property: The Citus version of cluster.. + * + * @param citusVersion The Citus version of cluster. + * @return the next definition stage. + */ + WithCreate withCitusVersion(String citusVersion); + } + /** The stage of the ClusterResponse definition allowing to specify enableShardsOnCoordinator. */ + interface WithEnableShardsOnCoordinator { + /** + * Specifies the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the + * cluster.. + * + * @param enableShardsOnCoordinator If shards on coordinator is enabled or not for the cluster. + * @return the next definition stage. + */ + WithCreate withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator); + } + /** The stage of the ClusterResponse definition allowing to specify enableHa. */ + interface WithEnableHa { + /** + * Specifies the enableHa property: If high availability is enabled or not for the cluster.. + * + * @param enableHa If high availability is enabled or not for the cluster. + * @return the next definition stage. + */ + WithCreate withEnableHa(Boolean enableHa); + } + /** The stage of the ClusterResponse definition allowing to specify preferredPrimaryZone. */ + interface WithPreferredPrimaryZone { + /** + * Specifies the preferredPrimaryZone property: Preferred primary zone for the cluster. + * + * @param preferredPrimaryZone Preferred primary zone for the cluster. + * @return the next definition stage. + */ + WithCreate withPreferredPrimaryZone(String preferredPrimaryZone); + } + /** The stage of the ClusterResponse definition allowing to specify coordinatorServerEdition. */ + interface WithCoordinatorServerEdition { + /** + * Specifies the coordinatorServerEdition property: The edition of the coordinator (default: + * GeneralPurpose). Required for creation.. + * + * @param coordinatorServerEdition The edition of the coordinator (default: GeneralPurpose). Required for + * creation. + * @return the next definition stage. + */ + WithCreate withCoordinatorServerEdition(String coordinatorServerEdition); + } + /** The stage of the ClusterResponse definition allowing to specify coordinatorStorageQuotaInMb. */ + interface WithCoordinatorStorageQuotaInMb { + /** + * Specifies the coordinatorStorageQuotaInMb property: The storage of the coordinator in MB. Required for + * creation.. + * + * @param coordinatorStorageQuotaInMb The storage of the coordinator in MB. Required for creation. + * @return the next definition stage. + */ + WithCreate withCoordinatorStorageQuotaInMb(Long coordinatorStorageQuotaInMb); + } + /** The stage of the ClusterResponse definition allowing to specify coordinatorVCores. */ + interface WithCoordinatorVCores { + /** + * Specifies the coordinatorVCores property: The vCores count of the coordinator (max: 64). Required for + * creation.. + * + * @param coordinatorVCores The vCores count of the coordinator (max: 64). Required for creation. + * @return the next definition stage. + */ + WithCreate withCoordinatorVCores(Long coordinatorVCores); + } + /** The stage of the ClusterResponse definition allowing to specify coordinatorEnablePublicIpAccess. */ + interface WithCoordinatorEnablePublicIpAccess { + /** + * Specifies the coordinatorEnablePublicIpAccess property: If public IP is requested or not for the + * coordinator.. + * + * @param coordinatorEnablePublicIpAccess If public IP is requested or not for the coordinator. + * @return the next definition stage. + */ + WithCreate withCoordinatorEnablePublicIpAccess(Boolean coordinatorEnablePublicIpAccess); + } + /** The stage of the ClusterResponse definition allowing to specify nodeServerEdition. */ + interface WithNodeServerEdition { + /** + * Specifies the nodeServerEdition property: The edition of a node (default: MemoryOptimized).. + * + * @param nodeServerEdition The edition of a node (default: MemoryOptimized). + * @return the next definition stage. + */ + WithCreate withNodeServerEdition(String nodeServerEdition); + } + /** The stage of the ClusterResponse definition allowing to specify nodeCount. */ + interface WithNodeCount { + /** + * Specifies the nodeCount property: Worker node count of the cluster. When node count is 0, it represents a + * coordinator with the ability to create distributed tables on that node. Node count value can not be 1.. + * + * @param nodeCount Worker node count of the cluster. When node count is 0, it represents a coordinator with + * the ability to create distributed tables on that node. Node count value can not be 1. + * @return the next definition stage. + */ + WithCreate withNodeCount(Long nodeCount); + } + /** The stage of the ClusterResponse definition allowing to specify nodeStorageQuotaInMb. */ + interface WithNodeStorageQuotaInMb { + /** + * Specifies the nodeStorageQuotaInMb property: The storage of a node in MB.. + * + * @param nodeStorageQuotaInMb The storage of a node in MB. + * @return the next definition stage. + */ + WithCreate withNodeStorageQuotaInMb(Long nodeStorageQuotaInMb); + } + /** The stage of the ClusterResponse definition allowing to specify nodeVCores. */ + interface WithNodeVCores { + /** + * Specifies the nodeVCores property: The vCores count of a node (max: 64).. + * + * @param nodeVCores The vCores count of a node (max: 64). + * @return the next definition stage. + */ + WithCreate withNodeVCores(Long nodeVCores); + } + /** The stage of the ClusterResponse definition allowing to specify nodeEnablePublicIpAccess. */ + interface WithNodeEnablePublicIpAccess { + /** + * Specifies the nodeEnablePublicIpAccess property: If public IP is requested or not for a node.. + * + * @param nodeEnablePublicIpAccess If public IP is requested or not for a node. + * @return the next definition stage. + */ + WithCreate withNodeEnablePublicIpAccess(Boolean nodeEnablePublicIpAccess); + } + /** The stage of the ClusterResponse definition allowing to specify maintenanceWindow. */ + interface WithMaintenanceWindow { + /** + * Specifies the maintenanceWindow property: Maintenance window of a cluster.. + * + * @param maintenanceWindow Maintenance window of a cluster. + * @return the next definition stage. + */ + WithCreate withMaintenanceWindow(MaintenanceWindow maintenanceWindow); + } + /** The stage of the ClusterResponse definition allowing to specify sourceResourceId. */ + interface WithSourceResourceId { + /** + * Specifies the sourceResourceId property: The source resource id to restore from. It's required for + * 'PointInTimeRestore' or 'ReadReplica' operations. + * + * @param sourceResourceId The source resource id to restore from. It's required for 'PointInTimeRestore' or + * 'ReadReplica' operations. + * @return the next definition stage. + */ + WithCreate withSourceResourceId(String sourceResourceId); + } + /** The stage of the ClusterResponse definition allowing to specify sourceLocation. */ + interface WithSourceLocation { + /** + * Specifies the sourceLocation property: The source cluster location to restore from. It's required for + * 'PointInTimeRestore' or 'ReadReplica' operations. + * + * @param sourceLocation The source cluster location to restore from. It's required for 'PointInTimeRestore' + * or 'ReadReplica' operations. + * @return the next definition stage. + */ + WithCreate withSourceLocation(String sourceLocation); + } + } + /** + * Begins update for the ClusterResponse resource. + * + * @return the stage of resource update. + */ + ClusterResponse.Update update(); + + /** The template for ClusterResponse update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithAdministratorLoginPassword, + UpdateStages.WithPostgresqlVersion, + UpdateStages.WithCitusVersion, + UpdateStages.WithEnableShardsOnCoordinator, + UpdateStages.WithEnableHa, + UpdateStages.WithPreferredPrimaryZone, + UpdateStages.WithCoordinatorServerEdition, + UpdateStages.WithCoordinatorStorageQuotaInMb, + UpdateStages.WithCoordinatorVCores, + UpdateStages.WithCoordinatorEnablePublicIpAccess, + UpdateStages.WithNodeServerEdition, + UpdateStages.WithNodeCount, + UpdateStages.WithNodeStorageQuotaInMb, + UpdateStages.WithNodeVCores, + UpdateStages.WithMaintenanceWindow { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ClusterResponse apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ClusterResponse apply(Context context); + } + /** The ClusterResponse update stages. */ + interface UpdateStages { + /** The stage of the ClusterResponse 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 ClusterResponse 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 ClusterResponse update allowing to specify postgresqlVersion. */ + interface WithPostgresqlVersion { + /** + * Specifies the postgresqlVersion property: The PostgreSQL version of the cluster.. + * + * @param postgresqlVersion The PostgreSQL version of the cluster. + * @return the next definition stage. + */ + Update withPostgresqlVersion(String postgresqlVersion); + } + /** The stage of the ClusterResponse update allowing to specify citusVersion. */ + interface WithCitusVersion { + /** + * Specifies the citusVersion property: The Citus version of the cluster.. + * + * @param citusVersion The Citus version of the cluster. + * @return the next definition stage. + */ + Update withCitusVersion(String citusVersion); + } + /** The stage of the ClusterResponse update allowing to specify enableShardsOnCoordinator. */ + interface WithEnableShardsOnCoordinator { + /** + * Specifies the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the + * cluster.. + * + * @param enableShardsOnCoordinator If shards on coordinator is enabled or not for the cluster. + * @return the next definition stage. + */ + Update withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator); + } + /** The stage of the ClusterResponse update allowing to specify enableHa. */ + interface WithEnableHa { + /** + * Specifies the enableHa property: If high availability is enabled or not for the cluster.. + * + * @param enableHa If high availability is enabled or not for the cluster. + * @return the next definition stage. + */ + Update withEnableHa(Boolean enableHa); + } + /** The stage of the ClusterResponse update allowing to specify preferredPrimaryZone. */ + interface WithPreferredPrimaryZone { + /** + * Specifies the preferredPrimaryZone property: Preferred primary zone for the cluster. + * + * @param preferredPrimaryZone Preferred primary zone for the cluster. + * @return the next definition stage. + */ + Update withPreferredPrimaryZone(String preferredPrimaryZone); + } + /** The stage of the ClusterResponse update allowing to specify coordinatorServerEdition. */ + interface WithCoordinatorServerEdition { + /** + * Specifies the coordinatorServerEdition property: The edition of the coordinator (default: + * GeneralPurpose).. + * + * @param coordinatorServerEdition The edition of the coordinator (default: GeneralPurpose). + * @return the next definition stage. + */ + Update withCoordinatorServerEdition(String coordinatorServerEdition); + } + /** The stage of the ClusterResponse update allowing to specify coordinatorStorageQuotaInMb. */ + interface WithCoordinatorStorageQuotaInMb { + /** + * Specifies the coordinatorStorageQuotaInMb property: The storage of the coordinator in MB.. + * + * @param coordinatorStorageQuotaInMb The storage of the coordinator in MB. + * @return the next definition stage. + */ + Update withCoordinatorStorageQuotaInMb(Long coordinatorStorageQuotaInMb); + } + /** The stage of the ClusterResponse update allowing to specify coordinatorVCores. */ + interface WithCoordinatorVCores { + /** + * Specifies the coordinatorVCores property: The vCores count of the coordinator (max: 64).. + * + * @param coordinatorVCores The vCores count of the coordinator (max: 64). + * @return the next definition stage. + */ + Update withCoordinatorVCores(Long coordinatorVCores); + } + /** The stage of the ClusterResponse update allowing to specify coordinatorEnablePublicIpAccess. */ + interface WithCoordinatorEnablePublicIpAccess { + /** + * Specifies the coordinatorEnablePublicIpAccess property: If public IP is requested or not for the + * coordinator.. + * + * @param coordinatorEnablePublicIpAccess If public IP is requested or not for the coordinator. + * @return the next definition stage. + */ + Update withCoordinatorEnablePublicIpAccess(Boolean coordinatorEnablePublicIpAccess); + } + /** The stage of the ClusterResponse update allowing to specify nodeServerEdition. */ + interface WithNodeServerEdition { + /** + * Specifies the nodeServerEdition property: The edition of a node (default: MemoryOptimized).. + * + * @param nodeServerEdition The edition of a node (default: MemoryOptimized). + * @return the next definition stage. + */ + Update withNodeServerEdition(String nodeServerEdition); + } + /** The stage of the ClusterResponse update allowing to specify nodeCount. */ + interface WithNodeCount { + /** + * Specifies the nodeCount property: Worker node count of the cluster. When node count is 0, it represents a + * coordinator with the ability to create distributed tables on that node. Node count value can not be 1.. + * + * @param nodeCount Worker node count of the cluster. When node count is 0, it represents a coordinator with + * the ability to create distributed tables on that node. Node count value can not be 1. + * @return the next definition stage. + */ + Update withNodeCount(Long nodeCount); + } + /** The stage of the ClusterResponse update allowing to specify nodeStorageQuotaInMb. */ + interface WithNodeStorageQuotaInMb { + /** + * Specifies the nodeStorageQuotaInMb property: The storage of a node in MB.. + * + * @param nodeStorageQuotaInMb The storage of a node in MB. + * @return the next definition stage. + */ + Update withNodeStorageQuotaInMb(Long nodeStorageQuotaInMb); + } + /** The stage of the ClusterResponse update allowing to specify nodeVCores. */ + interface WithNodeVCores { + /** + * Specifies the nodeVCores property: The vCores count of a node (max: 64).. + * + * @param nodeVCores The vCores count of a node (max: 64). + * @return the next definition stage. + */ + Update withNodeVCores(Long nodeVCores); + } + /** The stage of the ClusterResponse update allowing to specify maintenanceWindow. */ + interface WithMaintenanceWindow { + /** + * Specifies the maintenanceWindow property: Maintenance window of a cluster.. + * + * @param maintenanceWindow Maintenance window of a cluster. + * @return the next definition stage. + */ + Update withMaintenanceWindow(MaintenanceWindow maintenanceWindow); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ClusterResponse refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ClusterResponse refresh(Context context); + + /** + * Restarts the cluster. + * + * @throws com.azure.core.management.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 cluster. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 cluster. + * + * @throws com.azure.core.management.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 cluster. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 cluster. + * + * @throws com.azure.core.management.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 cluster. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * Promote the read replica cluster. + * + * @throws com.azure.core.management.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 promoteReadReplica(); + + /** + * Promote the read replica cluster. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 promoteReadReplica(Context context); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterServer.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterServer.java new file mode 100644 index 0000000000000..4a7bbfb786b5f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterServer.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ClusterServerInner; + +/** An immutable client-side representation of ClusterServer. */ +public interface ClusterServer { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the 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 cluster. + * + * @return the role value. + */ + ServerRole role(); + + /** + * Gets the state property: A state of a cluster/server that is visible to user. + * + * @return the state value. + */ + String state(); + + /** + * Gets the haState property: A state of HA feature for the cluster. + * + * @return the haState value. + */ + String haState(); + + /** + * Gets the availabilityZone property: Availability Zone information of the server. + * + * @return the availabilityZone value. + */ + String availabilityZone(); + + /** + * Gets the postgresqlVersion property: The PostgreSQL version of server. + * + * @return the postgresqlVersion value. + */ + String postgresqlVersion(); + + /** + * Gets the citusVersion property: The Citus version of server. + * + * @return the citusVersion value. + */ + String citusVersion(); + + /** + * Gets the serverEdition property: The edition of a server. + * + * @return the serverEdition value. + */ + String serverEdition(); + + /** + * Gets the storageQuotaInMb property: The storage of a server in MB. + * + * @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.ClusterServerInner object. + * + * @return the inner object. + */ + ClusterServerInner innerModel(); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterServerListResult.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterServerListResult.java new file mode 100644 index 0000000000000..f2526ec487617 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterServerListResult.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.resourcemanager.postgresqlhsc.fluent.models.ClusterServerInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of servers in a cluster. */ +@Fluent +public final class ClusterServerListResult { + /* + * The list of servers in a cluster. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of ClusterServerListResult class. */ + public ClusterServerListResult() { + } + + /** + * Get the value property: The list of servers in a cluster. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of servers in a cluster. + * + * @param value the value value to set. + * @return the ClusterServerListResult object itself. + */ + public ClusterServerListResult 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/Clusters.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Clusters.java new file mode 100644 index 0000000000000..95e89ac587e65 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Clusters.java @@ -0,0 +1,272 @@ +// 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 Clusters. */ +public interface Clusters { + /** + * List all the clusters 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 clusters as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List all the clusters 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 clusters as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List all the clusters 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 clusters as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all the clusters 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 clusters as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets information about a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 cluster along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String clusterName, Context context); + + /** + * Gets information about a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 cluster. + */ + ClusterResponse getByResourceGroup(String resourceGroupName, String clusterName); + + /** + * Deletes a cluster together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName); + + /** + * Deletes a cluster together with servers in it. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName, Context context); + + /** + * Restarts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName); + + /** + * Restarts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName, Context context); + + /** + * Starts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName); + + /** + * Starts the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName, Context context); + + /** + * Stops the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName); + + /** + * Stops the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName, Context context); + + /** + * Promote the read replica cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 promoteReadReplica(String resourceGroupName, String clusterName); + + /** + * Promote the read replica cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 promoteReadReplica(String resourceGroupName, String clusterName, Context context); + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability along with {@link Response}. + */ + Response checkNameAvailabilityWithResponse( + NameAvailabilityRequest nameAvailabilityRequest, Context context); + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + NameAvailability checkNameAvailability(NameAvailabilityRequest nameAvailabilityRequest); + + /** + * Gets information about a cluster. + * + * @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 cluster along with {@link Response}. + */ + ClusterResponse getById(String id); + + /** + * Gets information about a cluster. + * + * @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 cluster along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a cluster 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 cluster 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 ClusterResponse resource. + * + * @param name resource name. + * @return the first stage of the new ClusterResponse definition. + */ + ClusterResponse.DefinitionStages.Blank define(String name); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Configuration.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Configuration.java new file mode 100644 index 0000000000000..b20fba8754133 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Configuration.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.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ConfigurationInner; +import java.util.List; + +/** An immutable client-side representation of Configuration. */ +public interface Configuration { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the 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 requiresRestart property: If configuration change requires restart. + * + * @return the requiresRestart value. + */ + Boolean requiresRestart(); + + /** + * 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.ConfigurationInner object. + * + * @return the inner object. + */ + ConfigurationInner innerModel(); +} 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..dd59a09eb7056 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ConfigurationDataType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Data type of the configuration. */ +public final class ConfigurationDataType extends ExpandableStringEnum { + /** Static value Boolean for ConfigurationDataType. */ + public static final ConfigurationDataType BOOLEAN = fromString("Boolean"); + + /** Static value Numeric for ConfigurationDataType. */ + public static final ConfigurationDataType NUMERIC = fromString("Numeric"); + + /** Static value Integer for ConfigurationDataType. */ + public static final ConfigurationDataType INTEGER = fromString("Integer"); + + /** Static value Enumeration for ConfigurationDataType. */ + public static final ConfigurationDataType ENUMERATION = fromString("Enumeration"); + + /** + * Creates or finds a ConfigurationDataType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConfigurationDataType. + */ + @JsonCreator + public static ConfigurationDataType fromString(String name) { + return fromString(name, ConfigurationDataType.class); + } + + /** + * Gets known ConfigurationDataType values. + * + * @return known ConfigurationDataType values. + */ + public static Collection values() { + return values(ConfigurationDataType.class); + } +} diff --git a/sdk/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..b6e54643b13e5 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Configurations.java @@ -0,0 +1,163 @@ +// 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 Configurations. */ +public interface Configurations { + /** + * List all the configurations of a server in cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String clusterName, String serverName); + + /** + * List all the configurations of a server in cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String clusterName, String serverName, Context context); + + /** + * List all the configurations of a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of cluster configurations as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCluster(String resourceGroupName, String clusterName); + + /** + * List all the configurations of a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of cluster configurations as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCluster(String resourceGroupName, String clusterName, Context context); + + /** + * Gets information of a configuration for coordinator and nodes. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster 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 of a configuration for coordinator and nodes along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String clusterName, String configurationName, Context context); + + /** + * Gets information of a configuration for coordinator and nodes. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster 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 of a configuration for coordinator and nodes. + */ + Configuration get(String resourceGroupName, String clusterName, String configurationName); + + /** + * Updates configuration of coordinator in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration. + */ + ServerConfiguration updateCoordinator( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest parameters); + + /** + * Updates configuration of coordinator in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration. + */ + ServerConfiguration updateCoordinator( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest parameters, + Context context); + + /** + * Updates configuration of nodes in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration. + */ + ServerConfiguration updateNode( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationRequest parameters); + + /** + * Updates configuration of nodes in a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param configurationName The name of the cluster configuration. + * @param parameters The required parameters for updating a cluster configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a configuration. + */ + ServerConfiguration updateNode( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationRequest parameters, + Context context); +} 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..662709b25ed28 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/FirewallRule.java @@ -0,0 +1,199 @@ +// 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: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the startIpAddress property: The start IP address of the cluster firewall rule. Must be IPv4 format. + * + * @return the startIpAddress value. + */ + String startIpAddress(); + + /** + * Gets the endIpAddress property: The end IP address of the cluster firewall rule. Must be IPv4 format. + * + * @return the endIpAddress value. + */ + String endIpAddress(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.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, clusterName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @return the next definition stage. + */ + WithStartIpAddress withExistingServerGroupsv2(String resourceGroupName, String clusterName); + } + /** The stage of the FirewallRule definition allowing to specify startIpAddress. */ + interface WithStartIpAddress { + /** + * Specifies the startIpAddress property: The start IP address of the cluster firewall rule. Must be IPv4 + * format.. + * + * @param startIpAddress The start IP address of the cluster 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 cluster firewall rule. Must be IPv4 + * format.. + * + * @param endIpAddress The end IP address of the cluster 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 cluster firewall rule. Must be IPv4 + * format.. + * + * @param startIpAddress The start IP address of the cluster 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 cluster firewall rule. Must be IPv4 + * format.. + * + * @param endIpAddress The end IP address of the cluster 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..d5a185a5ed3b7 --- /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.resourcemanager.postgresqlhsc.fluent.models.FirewallRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of firewall rules. */ +@Fluent +public final class FirewallRuleListResult { + /* + * The list of firewall rules in a cluster. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of FirewallRuleListResult class. */ + public FirewallRuleListResult() { + } + + /** + * Get the value property: The list of firewall rules in a cluster. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of firewall rules in a cluster. + * + * @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..57687e2984f69 --- /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 cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 clusterName, String firewallRuleName); + + /** + * Deletes a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 clusterName, String firewallRuleName, Context context); + + /** + * Gets information about a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String clusterName, String firewallRuleName, Context context); + + /** + * Gets information about a cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param firewallRuleName The name of the cluster 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 cluster firewall rule. + */ + FirewallRule get(String resourceGroupName, String clusterName, String firewallRuleName); + + /** + * List all the firewall rules in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCluster(String resourceGroupName, String clusterName); + + /** + * List all the firewall rules in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCluster(String resourceGroupName, String clusterName, Context context); + + /** + * Gets information about a cluster 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 cluster firewall rule along with {@link Response}. + */ + FirewallRule getById(String id); + + /** + * Gets information about a cluster 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 cluster firewall rule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a cluster 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 cluster 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..eafdbe7b995ed --- /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.fasterxml.jackson.annotation.JsonProperty; + +/** Maintenance window of a cluster. */ +@Fluent +public final class MaintenanceWindow { + /* + * indicates whether custom window is enabled or disabled + */ + @JsonProperty(value = "customWindow") + private String customWindow; + + /* + * start hour for maintenance window + */ + @JsonProperty(value = "startHour") + private Integer startHour; + + /* + * start minute for maintenance window + */ + @JsonProperty(value = "startMinute") + private Integer startMinute; + + /* + * day of week for maintenance window + */ + @JsonProperty(value = "dayOfWeek") + private Integer dayOfWeek; + + /** Creates an instance of MaintenanceWindow class. */ + public MaintenanceWindow() { + } + + /** + * Get the customWindow property: indicates whether custom window is enabled or disabled. + * + * @return the customWindow value. + */ + public String customWindow() { + return this.customWindow; + } + + /** + * Set the customWindow property: indicates whether custom window is enabled or disabled. + * + * @param customWindow the customWindow value to set. + * @return the MaintenanceWindow object itself. + */ + public MaintenanceWindow withCustomWindow(String customWindow) { + this.customWindow = customWindow; + return this; + } + + /** + * Get the startHour property: start hour for maintenance window. + * + * @return the startHour value. + */ + public Integer startHour() { + return this.startHour; + } + + /** + * Set the startHour property: start hour for maintenance window. + * + * @param startHour the startHour value to set. + * @return the MaintenanceWindow object itself. + */ + public MaintenanceWindow withStartHour(Integer startHour) { + this.startHour = startHour; + return this; + } + + /** + * Get the startMinute property: start minute for maintenance window. + * + * @return the startMinute value. + */ + public Integer startMinute() { + return this.startMinute; + } + + /** + * Set the startMinute property: start minute for maintenance window. + * + * @param startMinute the startMinute value to set. + * @return the MaintenanceWindow object itself. + */ + public MaintenanceWindow withStartMinute(Integer startMinute) { + this.startMinute = startMinute; + return this; + } + + /** + * Get the dayOfWeek property: day of week for maintenance window. + * + * @return the dayOfWeek value. + */ + public Integer dayOfWeek() { + return this.dayOfWeek; + } + + /** + * Set the dayOfWeek property: day of week for maintenance window. + * + * @param dayOfWeek the dayOfWeek value to set. + * @return the MaintenanceWindow object itself. + */ + public MaintenanceWindow withDayOfWeek(Integer dayOfWeek) { + this.dayOfWeek = dayOfWeek; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/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..dfd81c5998793 --- /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 cluster. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: type of the cluster. + * + * @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..256cb1bcd0964 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/NameAvailabilityRequest.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Request from client to check resource name availability. */ +@Fluent +public final class NameAvailabilityRequest { + /* + * 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NameAvailabilityRequest.class); +} 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..cff03ae2db589 --- /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.fasterxml.jackson.annotation.JsonProperty; + +/** Display metadata associated with the operation. */ +@Immutable +public final class OperationDisplay { + /* + * Operation resource provider name. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * Resource on which the operation is performed. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * Localized friendly name for the operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * Operation description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + + /** + * Get the provider property: Operation resource provider name. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: Resource on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: Localized friendly name for the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: Operation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/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..c412a6208c88d --- /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.resourcemanager.postgresqlhsc.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of resource provider operations. */ +@Fluent +public final class OperationListResult { + /* + * Collection of available operation details + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of OperationListResult class. */ + public OperationListResult() { + } + + /** + * 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..cd36ab968664d --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/OperationOrigin.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The intended executor of the operation. */ +public final class OperationOrigin extends ExpandableStringEnum { + /** Static value NotSpecified for OperationOrigin. */ + public static final OperationOrigin NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value user for OperationOrigin. */ + public static final OperationOrigin USER = fromString("user"); + + /** Static value system for OperationOrigin. */ + public static final OperationOrigin SYSTEM = fromString("system"); + + /** + * Creates or finds a OperationOrigin from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationOrigin. + */ + @JsonCreator + public static OperationOrigin fromString(String name) { + return fromString(name, OperationOrigin.class); + } + + /** + * Gets known OperationOrigin values. + * + * @return known OperationOrigin values. + */ + public static Collection values() { + return values(OperationOrigin.class); + } +} diff --git a/sdk/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..edde5b98b2528 --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnection.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..5e09a4643b518 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnection.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.PrivateEndpointConnectionSimpleProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnection extends ProxyResource { + /* + * Properties of the private endpoint connection. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionSimpleProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of PrivateEndpointConnection class. */ + public PrivateEndpointConnection() { + } + + /** + * Get the innerProperties property: Properties of the private endpoint connection. + * + * @return the innerProperties value. + */ + private PrivateEndpointConnectionSimpleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnection object itself. + */ + public PrivateEndpointConnection withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionSimpleProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the groupIds property: Group ids of the private endpoint connection. + * + * @return the groupIds value. + */ + public List groupIds() { + return this.innerProperties() == null ? null : this.innerProperties().groupIds(); + } + + /** + * Set the groupIds property: Group ids of the private endpoint connection. + * + * @param groupIds the groupIds value to set. + * @return the PrivateEndpointConnection object itself. + */ + public PrivateEndpointConnection withGroupIds(List groupIds) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionSimpleProperties(); + } + this.innerProperties().withGroupIds(groupIds); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnection object itself. + */ + public PrivateEndpointConnection withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionSimpleProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + 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/PrivateEndpointConnectionActionRequest.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnectionActionRequest.java new file mode 100644 index 0000000000000..fb0782b4a8c0a --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnectionActionRequest.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.PrivateEndpointConnectionActionRequestProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionActionRequest { + /* + * Properties of the private endpoint connection. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionActionRequestProperties innerProperties; + + /** Creates an instance of PrivateEndpointConnectionActionRequest class. */ + public PrivateEndpointConnectionActionRequest() { + } + + /** + * Get the innerProperties property: Properties of the private endpoint connection. + * + * @return the innerProperties value. + */ + private PrivateEndpointConnectionActionRequestProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionActionRequest object itself. + */ + public PrivateEndpointConnectionActionRequest withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionActionRequestProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + 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/PrivateEndpointConnectionListResult.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 0000000000000..f71fafeffbdaf --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnectionListResult.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.resourcemanager.postgresqlhsc.fluent.models.PrivateEndpointConnectionPropertyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private endpoint connections. */ +@Fluent +public final class PrivateEndpointConnectionListResult { + /* + * The list of private endpoint connections + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of PrivateEndpointConnectionListResult class. */ + public PrivateEndpointConnectionListResult() { + } + + /** + * Get the value property: The list of private endpoint connections. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of private endpoint connections. + * + * @param value the value value to set. + * @return the PrivateEndpointConnectionListResult object itself. + */ + public PrivateEndpointConnectionListResult 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/PrivateEndpointConnectionProperty.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnectionProperty.java new file mode 100644 index 0000000000000..edc3bd0152fb2 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnectionProperty.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.PrivateEndpointConnectionPropertyInner; +import java.util.List; + +/** An immutable client-side representation of PrivateEndpointConnectionProperty. */ +public interface PrivateEndpointConnectionProperty { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + PrivateEndpointProperty privateEndpoint(); + + /** + * Gets the groupIds property: Group ids of the private endpoint connection. + * + * @return the groupIds value. + */ + List groupIds(); + + /** + * Gets the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState(); + + /** + * Gets the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlhsc.fluent.models.PrivateEndpointConnectionPropertyInner + * object. + * + * @return the inner object. + */ + PrivateEndpointConnectionPropertyInner innerModel(); + + /** The entirety of the PrivateEndpointConnectionProperty definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The PrivateEndpointConnectionProperty definition stages. */ + interface DefinitionStages { + /** The first stage of the PrivateEndpointConnectionProperty definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PrivateEndpointConnectionProperty definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, clusterName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @return the next definition stage. + */ + WithCreate withExistingServerGroupsv2(String resourceGroupName, String clusterName); + } + /** + * The stage of the PrivateEndpointConnectionProperty 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.WithPrivateLinkServiceConnectionState { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateEndpointConnectionProperty create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnectionProperty create(Context context); + } + /** + * The stage of the PrivateEndpointConnectionProperty definition allowing to specify + * privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Connection state of the private endpoint + * connection.. + * + * @param privateLinkServiceConnectionState Connection state of the private endpoint connection. + * @return the next definition stage. + */ + WithCreate withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState); + } + } + /** + * Begins update for the PrivateEndpointConnectionProperty resource. + * + * @return the stage of resource update. + */ + PrivateEndpointConnectionProperty.Update update(); + + /** The template for PrivateEndpointConnectionProperty update. */ + interface Update extends UpdateStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PrivateEndpointConnectionProperty apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PrivateEndpointConnectionProperty apply(Context context); + } + /** The PrivateEndpointConnectionProperty update stages. */ + interface UpdateStages { + /** + * The stage of the PrivateEndpointConnectionProperty update allowing to specify + * privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Connection state of the private endpoint + * connection.. + * + * @param privateLinkServiceConnectionState Connection state of the private endpoint connection. + * @return the next definition stage. + */ + Update withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateEndpointConnectionProperty refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnectionProperty refresh(Context context); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnections.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnections.java new file mode 100644 index 0000000000000..b36d74c460972 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnections.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.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateEndpointConnections. */ +public interface PrivateEndpointConnections { + /** + * Gets list of private endpoint connections on a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections on a cluster as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCluster(String resourceGroupName, String clusterName); + + /** + * Gets list of private endpoint connections on a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections on a cluster as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCluster( + String resourceGroupName, String clusterName, Context context); + + /** + * Gets private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String clusterName, String privateEndpointConnectionName, Context context); + + /** + * Gets private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection. + */ + PrivateEndpointConnectionProperty get( + String resourceGroupName, String clusterName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String clusterName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String clusterName, String privateEndpointConnectionName, Context context); + + /** + * Gets private endpoint connection. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection along with {@link Response}. + */ + PrivateEndpointConnectionProperty getById(String id); + + /** + * Gets private endpoint connection. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PrivateEndpointConnectionProperty resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnectionProperty definition. + */ + PrivateEndpointConnectionProperty.DefinitionStages.Blank define(String name); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnectionsCreateOrUpdateHeaders.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnectionsCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..53beaa5228b86 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnectionsCreateOrUpdateHeaders.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PrivateEndpointConnectionsCreateOrUpdateHeaders model. */ +@Fluent +public final class PrivateEndpointConnectionsCreateOrUpdateHeaders { + /* + * The azure-async-operation property. + */ + @JsonProperty(value = "azure-async-operation") + private String azureAsyncOperation; + + /* + * The location property. + */ + @JsonProperty(value = "location") + private String location; + + private static final HttpHeaderName AZURE_ASYNC_OPERATION = HttpHeaderName.fromString("azure-async-operation"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of PrivateEndpointConnectionsCreateOrUpdateHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public PrivateEndpointConnectionsCreateOrUpdateHeaders(HttpHeaders rawHeaders) { + this.azureAsyncOperation = rawHeaders.getValue(AZURE_ASYNC_OPERATION); + this.location = rawHeaders.getValue(HttpHeaderName.LOCATION); + } + + /** + * Get the azureAsyncOperation property: The azure-async-operation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The azure-async-operation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the PrivateEndpointConnectionsCreateOrUpdateHeaders object itself. + */ + public PrivateEndpointConnectionsCreateOrUpdateHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location property. + * + * @param location the location value to set. + * @return the PrivateEndpointConnectionsCreateOrUpdateHeaders object itself. + */ + public PrivateEndpointConnectionsCreateOrUpdateHeaders withLocation(String location) { + this.location = location; + 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/PrivateEndpointConnectionsCreateOrUpdateResponse.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnectionsCreateOrUpdateResponse.java new file mode 100644 index 0000000000000..e5bb4bd69b506 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnectionsCreateOrUpdateResponse.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.PrivateEndpointConnectionPropertyInner; + +/** Contains all response data for the createOrUpdate operation. */ +public final class PrivateEndpointConnectionsCreateOrUpdateResponse + extends ResponseBase { + /** + * Creates an instance of PrivateEndpointConnectionsCreateOrUpdateResponse. + * + * @param request the request which resulted in this PrivateEndpointConnectionsCreateOrUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public PrivateEndpointConnectionsCreateOrUpdateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + PrivateEndpointConnectionPropertyInner value, + PrivateEndpointConnectionsCreateOrUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public PrivateEndpointConnectionPropertyInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointProperty.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointProperty.java new file mode 100644 index 0000000000000..6a5bc3f8e8347 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointProperty.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Property to represent resource id of the private endpoint. */ +@Fluent +public final class PrivateEndpointProperty { + /* + * Resource id of the private endpoint. + */ + @JsonProperty(value = "id") + private String id; + + /** Creates an instance of PrivateEndpointProperty class. */ + public PrivateEndpointProperty() { + } + + /** + * Get the id property: Resource id of the private endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource id of the private endpoint. + * + * @param id the id value to set. + * @return the PrivateEndpointProperty object itself. + */ + public PrivateEndpointProperty withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateLinkResource.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateLinkResource.java new file mode 100644 index 0000000000000..1514557a05b20 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateLinkResource.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.PrivateLinkResourceInner; +import java.util.List; + +/** An immutable client-side representation of PrivateLinkResource. */ +public interface PrivateLinkResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + String groupId(); + + /** + * Gets the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + List requiredMembers(); + + /** + * Gets the requiredZoneNames property: The private link resource zone names. + * + * @return the requiredZoneNames value. + */ + List requiredZoneNames(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlhsc.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateLinkResourceListResult.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateLinkResourceListResult.java new file mode 100644 index 0000000000000..9744002128f55 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateLinkResourceListResult.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.resourcemanager.postgresqlhsc.fluent.models.PrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Fluent +public final class PrivateLinkResourceListResult { + /* + * The list of private link resources. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link used to get the next page of private link resources. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of PrivateLinkResourceListResult class. */ + public PrivateLinkResourceListResult() { + } + + /** + * Get the value property: The list of private link resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of private link resources. + * + * @param value the value value to set. + * @return the PrivateLinkResourceListResult object itself. + */ + public PrivateLinkResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link used to get the next page of private link resources. + * + * @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/PrivateLinkResources.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateLinkResources.java new file mode 100644 index 0000000000000..d415a930414a1 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateLinkResources.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 PrivateLinkResources. */ +public interface PrivateLinkResources { + /** + * Gets the private link resources for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for cluster as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCluster(String resourceGroupName, String clusterName); + + /** + * Gets the private link resources for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for cluster as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCluster(String resourceGroupName, String clusterName, Context context); + + /** + * Gets a private link resource for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateLinkResourceName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for cluster along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String clusterName, String privateLinkResourceName, Context context); + + /** + * Gets a private link resource for cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateLinkResourceName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for cluster. + */ + PrivateLinkResource get(String resourceGroupName, String clusterName, String privateLinkResourceName); +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateLinkServiceConnectionState.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 0000000000000..3ade9b128a565 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateLinkServiceConnectionState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The private link service connection state. */ +@Fluent +public final class PrivateLinkServiceConnectionState { + /* + * The private link service connection description. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The private link service connection status. + */ + @JsonProperty(value = "status") + private String status; + + /** Creates an instance of PrivateLinkServiceConnectionState class. */ + public PrivateLinkServiceConnectionState() { + } + + /** + * Get the description property: The private link service connection description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The private link service connection description. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the status property: The private link service connection status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The private link service connection status. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withStatus(String status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateLinkServiceConnectionStateProperty.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 0000000000000..203c3ba497144 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateLinkServiceConnectionStateProperty.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties in private link service connection state. */ +@Fluent +public final class PrivateLinkServiceConnectionStateProperty { + /* + * The actions required for private link service connection. + */ + @JsonProperty(value = "actionsRequired") + private String actionsRequired; + + /* + * The private link service connection description. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The private link service connection status. + */ + @JsonProperty(value = "status") + private String status; + + /** Creates an instance of PrivateLinkServiceConnectionStateProperty class. */ + public PrivateLinkServiceConnectionStateProperty() { + } + + /** + * Get the actionsRequired property: The actions required for private link service connection. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Set the actionsRequired property: The actions required for private link service connection. + * + * @param actionsRequired the actionsRequired value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withActionsRequired(String actionsRequired) { + this.actionsRequired = actionsRequired; + return this; + } + + /** + * Get the description property: The private link service connection description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The private link service connection description. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the status property: The private link service connection status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The private link service connection status. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withStatus(String status) { + this.status = status; + return this; + } + + /** + * 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/Role.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Role.java new file mode 100644 index 0000000000000..187528a62867d --- /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: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the password property: The password of the cluster 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, clusterName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @return the next definition stage. + */ + WithCreate withExistingServerGroupsv2(String resourceGroupName, String clusterName); + } + /** + * 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 cluster role.. + * + * @param password The password of the cluster 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..53c9fd8bbd022 --- /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.resourcemanager.postgresqlhsc.fluent.models.RoleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of roles. */ +@Fluent +public final class RoleListResult { + /* + * The list of roles in a cluster. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of RoleListResult class. */ + public RoleListResult() { + } + + /** + * Get the value property: The list of roles in a cluster. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of roles in a cluster. + * + * @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..48cca295ca8e2 --- /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 cluster role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param roleName The name of the cluster 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. + */ + void delete(String resourceGroupName, String clusterName, String roleName); + + /** + * Deletes a cluster role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param roleName The name of the cluster 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. + */ + void delete(String resourceGroupName, String clusterName, String roleName, Context context); + + /** + * List all the roles in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCluster(String resourceGroupName, String clusterName); + + /** + * List all the roles in a given cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCluster(String resourceGroupName, String clusterName, Context context); + + /** + * Deletes a cluster 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 cluster 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..71c962a0ee839 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerConfiguration.java @@ -0,0 +1,95 @@ +// 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: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the value property: Value of the configuration. + * + * @return the value value. + */ + String value(); + + /** + * Gets the 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 requiresRestart property: If configuration change requires restart. + * + * @return the requiresRestart value. + */ + Boolean requiresRestart(); + + /** + * 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..20c1ada9acc8a --- /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.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server configurations. */ +@Fluent +public final class ServerConfigurationListResult { + /* + * 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; + + /** Creates an instance of ServerConfigurationListResult class. */ + public ServerConfigurationListResult() { + } + + /** + * 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/ServerConfigurationRequest.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerConfigurationRequest.java new file mode 100644 index 0000000000000..7ff08ec721b02 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerConfigurationRequest.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.annotation.Fluent; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationRequestProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a configuration. */ +@Fluent +public final class ServerConfigurationRequest { + /* + * Represents a configuration properties + */ + @JsonProperty(value = "properties") + private ServerConfigurationRequestProperties innerProperties; + + /** Creates an instance of ServerConfigurationRequest class. */ + public ServerConfigurationRequest() { + } + + /** + * Get the innerProperties property: Represents a configuration properties. + * + * @return the innerProperties value. + */ + private ServerConfigurationRequestProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the value property: Represents the value of a configuration. + * + * @return the value value. + */ + public String value() { + return this.innerProperties() == null ? null : this.innerProperties().value(); + } + + /** + * Set the value property: Represents the value of a configuration. + * + * @param value the value value to set. + * @return the ServerConfigurationRequest object itself. + */ + public ServerConfigurationRequest withValue(String value) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerConfigurationRequestProperties(); + } + this.innerProperties().withValue(value); + 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/ServerNameItem.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerNameItem.java new file mode 100644 index 0000000000000..ab2ed1f170870 --- /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.fasterxml.jackson.annotation.JsonProperty; + +/** The name object for a server. */ +@Fluent +public final class ServerNameItem { + /* + * 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; + + /** Creates an instance of ServerNameItem class. */ + public ServerNameItem() { + } + + /** + * 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..985b6845711eb --- /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.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a server. */ +@Fluent +public class ServerProperties { + /* + * The edition of a server + */ + @JsonProperty(value = "serverEdition") + private String serverEdition; + + /* + * The storage of a server in MB. + */ + @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; + + /** Creates an instance of ServerProperties class. */ + public ServerProperties() { + } + + /** + * Get the serverEdition property: The edition of a server. + * + * @return the serverEdition value. + */ + public String serverEdition() { + return this.serverEdition; + } + + /** + * Set the serverEdition property: The edition of a server. + * + * @param serverEdition the serverEdition value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withServerEdition(String serverEdition) { + this.serverEdition = serverEdition; + return this; + } + + /** + * Get the storageQuotaInMb property: The storage of a server in MB. + * + * @return the storageQuotaInMb value. + */ + public Long storageQuotaInMb() { + return this.storageQuotaInMb; + } + + /** + * Set the storageQuotaInMb property: The storage of a server in MB. + * + * @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..4e2ba21d0acfc --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerRole.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The role of a server. */ +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); + } + + /** + * Gets known ServerRole values. + * + * @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/ServerRoleGroupConfiguration.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerRoleGroupConfiguration.java new file mode 100644 index 0000000000000..948b40e6934f5 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerRoleGroupConfiguration.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents server role group configuration value. */ +@Fluent +public final class ServerRoleGroupConfiguration { + /* + * 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; + + /** Creates an instance of ServerRoleGroupConfiguration class. */ + public ServerRoleGroupConfiguration() { + } + + /** + * 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerRoleGroupConfiguration.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..3731d4533c952 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Servers.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.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 cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 cluster as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCluster(String resourceGroupName, String clusterName); + + /** + * Lists servers of a cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 cluster as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCluster(String resourceGroupName, String clusterName, Context context); + + /** + * Gets information about a server in cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @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 cluster along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String clusterName, String serverName, Context context); + + /** + * Gets information about a server in cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @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 cluster. + */ + ClusterServer get(String resourceGroupName, String clusterName, String serverName); +} 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..f34bac3624d8d --- /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 CosmosDBForPostgreSql. The Microsoft Azure management API provides create, + * read, update, and delete functionality for Cosmos DB for PostgreSQL resources including clusters, servers, + * configurations, firewall rules, roles, private endpoint connections and private link resources. + */ +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..ebdb3213e9a1e --- /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 CosmosDBForPostgreSql. The Microsoft Azure management API provides create, read, + * update, and delete functionality for Cosmos DB for PostgreSQL resources including clusters, servers, configurations, + * firewall rules, roles, private endpoint connections and private link resources. + */ +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/ClustersCheckNameAvailabilitySamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..3ca9faadc6065 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersCheckNameAvailabilitySamples.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 Clusters CheckNameAvailability. */ +public final class ClustersCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/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 + .clusters() + .checkNameAvailabilityWithResponse(new NameAvailabilityRequest().withName("name1"), Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersCreateOrUpdateSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..4d83eb561ed7f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersCreateOrUpdateSamples.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import java.util.HashMap; +import java.util.Map; + +/** Samples for Clusters CreateOrUpdate. */ +public final class ClustersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateReadReplica.json + */ + /** + * Sample code: Create a new cluster as a read replica. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void createANewClusterAsAReadReplica( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .clusters() + .define("hsctestsg") + .withExistingResourceGroup("TestGroup") + .withRegion("westus") + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/pgtests-source-cluster") + .withSourceLocation("westus") + .create(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreatePITR.json + */ + /** + * Sample code: Create a new cluster as a point in time restore. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void createANewClusterAsAPointInTimeRestore( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .clusters() + .define("hsctestsg") + .withExistingResourceGroup("TestGroup") + .withRegion("westus") + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/pgtests-source-cluster") + .withSourceLocation("westus") + .create(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreate.json + */ + /** + * Sample code: Create a new cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void createANewCluster(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .clusters() + .define("hsctestsg") + .withExistingResourceGroup("TestGroup") + .withRegion("westus") + .withTags(mapOf()) + .withAdministratorLoginPassword("p@ssword1234") + .withPostgresqlVersion("15") + .withCitusVersion("11.1") + .withEnableShardsOnCoordinator(false) + .withEnableHa(true) + .withPreferredPrimaryZone("1") + .withCoordinatorServerEdition("GeneralPurpose") + .withCoordinatorStorageQuotaInMb(524288L) + .withCoordinatorVCores(4L) + .withCoordinatorEnablePublicIpAccess(true) + .withNodeServerEdition("MemoryOptimized") + .withNodeCount(3L) + .withNodeStorageQuotaInMb(524288L) + .withNodeVCores(8L) + .withNodeEnablePublicIpAccess(false) + .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/ClustersDeleteSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersDeleteSamples.java new file mode 100644 index 0000000000000..01f44184ff76c --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersDeleteSamples.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 Clusters Delete. */ +public final class ClustersDeleteSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterDelete.json + */ + /** + * Sample code: Delete the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void deleteTheCluster(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().delete("TestGroup", "testcluster", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersGetByResourceGroupSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..f499349ee64f6 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersGetByResourceGroupSamples.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 Clusters GetByResourceGroup. */ +public final class ClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterGet.json + */ + /** + * Sample code: Get the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getTheCluster(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().getByResourceGroupWithResponse("TestGroup", "hsctestsg1", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersListByResourceGroupSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..4d426c3d53a40 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersListByResourceGroupSamples.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 Clusters ListByResourceGroup. */ +public final class ClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterListByResourceGroup.json + */ + /** + * Sample code: List the clusters by resource group. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listTheClustersByResourceGroup( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().listByResourceGroup("TestGroup", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersListSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersListSamples.java new file mode 100644 index 0000000000000..6907d2283a275 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersListSamples.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 Clusters List. */ +public final class ClustersListSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterList.json + */ + /** + * Sample code: List all the clusters. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listAllTheClusters(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().list(Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersPromoteReadReplicaSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersPromoteReadReplicaSamples.java new file mode 100644 index 0000000000000..4f3055dd36a27 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersPromoteReadReplicaSamples.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 Clusters PromoteReadReplica. */ +public final class ClustersPromoteReadReplicaSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterPromoteReadReplica.json + */ + /** + * Sample code: Promote the read replica. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void promoteTheReadReplica(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().promoteReadReplica("TestGroup", "hsctestsg1", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersRestartSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersRestartSamples.java new file mode 100644 index 0000000000000..f99f49f011ed2 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersRestartSamples.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 Clusters Restart. */ +public final class ClustersRestartSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterRestart.json + */ + /** + * Sample code: Restart all servers in the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void restartAllServersInTheCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().restart("TestGroup", "hsctestsg1", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersStartSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersStartSamples.java new file mode 100644 index 0000000000000..76baeb9d3e6e6 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersStartSamples.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 Clusters Start. */ +public final class ClustersStartSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterStart.json + */ + /** + * Sample code: Start all servers in the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void startAllServersInTheCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().start("TestGroup", "hsctestsg1", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersStopSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersStopSamples.java new file mode 100644 index 0000000000000..77d122dd65394 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersStopSamples.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 Clusters Stop. */ +public final class ClustersStopSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterStop.json + */ + /** + * Sample code: Stop all servers in the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void stopAllServersInTheCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().stop("TestGroup", "hsctestsg1", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersUpdateSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersUpdateSamples.java new file mode 100644 index 0000000000000..8a362c1e4fb69 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersUpdateSamples.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.models.ClusterResponse; +import com.azure.resourcemanager.postgresqlhsc.models.MaintenanceWindow; + +/** Samples for Clusters Update. */ +public final class ClustersUpdateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterScaleStorage.json + */ + /** + * Sample code: Scale storage. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void scaleStorage(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ClusterResponse resource = + manager.clusters().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource.update().withNodeStorageQuotaInMb(2097152L).apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterAddNode.json + */ + /** + * Sample code: Add new worker nodes. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void addNewWorkerNodes(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ClusterResponse resource = + manager.clusters().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource.update().withNodeCount(2L).apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterUpdateMaintenanceWindow.json + */ + /** + * Sample code: Update customer maintenance window. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateCustomerMaintenanceWindow( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ClusterResponse resource = + manager.clusters().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/stable/2022-11-08/examples/ClusterUpdate.json + */ + /** + * Sample code: Update the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateTheCluster(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ClusterResponse resource = + manager.clusters().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource + .update() + .withAdministratorLoginPassword("newP@ssword1") + .withCoordinatorVCores(16L) + .withNodeCount(4L) + .withNodeVCores(16L) + .apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterScaleCompute.json + */ + /** + * Sample code: Scale compute. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void scaleCompute(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + ClusterResponse resource = + manager.clusters().getByResourceGroupWithResponse("TestGroup", "hsctestsg", Context.NONE).getValue(); + resource.update().withNodeVCores(16L).apply(); + } +} 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..66b022fae17da --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsGetSamples.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 Configurations Get. */ +public final class ConfigurationsGetSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationGet.json + */ + /** + * Sample code: Get configuration details. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getConfigurationDetails(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/ConfigurationsListByClusterSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsListByClusterSamples.java new file mode 100644 index 0000000000000..9963c1b6b478f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsListByClusterSamples.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 ListByCluster. */ +public final class ConfigurationsListByClusterSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationListByCluster.json + */ + /** + * Sample code: List configurations of the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listConfigurationsOfTheCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.configurations().listByCluster("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..e43bd703f19cf --- /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/stable/2022-11-08/examples/ConfigurationListByServer.json + */ + /** + * Sample code: List configurations of the server that in the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listConfigurationsOfTheServerThatInTheCluster( + 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/ConfigurationsUpdateCoordinatorSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsUpdateCoordinatorSamples.java new file mode 100644 index 0000000000000..472b4f0555b63 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsUpdateCoordinatorSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.models.ServerConfigurationRequest; + +/** Samples for Configurations UpdateCoordinator. */ +public final class ConfigurationsUpdateCoordinatorSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationUpdateCoordinator.json + */ + /** + * Sample code: Update single configuration of coordinator. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateSingleConfigurationOfCoordinator( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .configurations() + .updateCoordinator( + "TestResourceGroup", + "hsctestsg", + "array_nulls", + new ServerConfigurationRequest().withValue("on"), + Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsUpdateNodeSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsUpdateNodeSamples.java new file mode 100644 index 0000000000000..3480ff451acaf --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsUpdateNodeSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.models.ServerConfigurationRequest; + +/** Samples for Configurations UpdateNode. */ +public final class ConfigurationsUpdateNodeSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationUpdateNode.json + */ + /** + * Sample code: Update single configuration of nodes. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateSingleConfigurationOfNodes( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .configurations() + .updateNode( + "TestResourceGroup", + "hsctestsg", + "array_nulls", + new ServerConfigurationRequest().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..bc18c749d7f81 --- /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/stable/2022-11-08/examples/FirewallRuleCreate.json + */ + /** + * Sample code: Create a firewall rule of the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void createAFirewallRuleOfTheCluster( + 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..c684d72c1dfa6 --- /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/stable/2022-11-08/examples/FirewallRuleDelete.json + */ + /** + * Sample code: Delete the firewall rule of the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void deleteTheFirewallRuleOfTheCluster( + 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..0870c4a0a13a2 --- /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/stable/2022-11-08/examples/FirewallRuleGet.json + */ + /** + * Sample code: Get the firewall rule of the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getTheFirewallRuleOfTheCluster( + 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/FirewallRulesListByClusterSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesListByClusterSamples.java new file mode 100644 index 0000000000000..be914a4ab8dd6 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesListByClusterSamples.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 ListByCluster. */ +public final class FirewallRulesListByClusterSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/FirewallRuleListByCluster.json + */ + /** + * Sample code: List firewall rules of the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listFirewallRulesOfTheCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.firewallRules().listByCluster("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..f29f80ba02846 --- /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/stable/2022-11-08/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/PrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..cded2aa799213 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.resourcemanager.postgresqlhsc.models.PrivateLinkServiceConnectionState; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateEndpointConnectionCreateOrUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .privateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingServerGroupsv2("TestGroup", "hsctestsg") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withDescription("Approved by johndoe@contoso.com") + .withStatus("Approved")) + .create(); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..3409ff94f1f5e --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateEndpointConnectionsDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .privateEndpointConnections() + .delete("TestGroup", "hsctestsg", "private-endpoint-connection-name", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..8ee2bfa45188f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateEndpointConnectionsGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .privateEndpointConnections() + .getWithResponse("TestGroup", "hsctestsg", "private-endpoint-connection-name", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateEndpointConnectionsListByClusterSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateEndpointConnectionsListByClusterSamples.java new file mode 100644 index 0000000000000..8084a174224f0 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateEndpointConnectionsListByClusterSamples.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 PrivateEndpointConnections ListByCluster. */ +public final class PrivateEndpointConnectionsListByClusterSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateEndpointConnectionsListByCluster.json + */ + /** + * Sample code: Gets list of private endpoint connections on a cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnACluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.privateEndpointConnections().listByCluster("TestResourceGroup", "hsctestsg", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateLinkResourcesGetSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateLinkResourcesGetSamples.java new file mode 100644 index 0000000000000..2440aa3de3de5 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateLinkResourcesGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateLinkResourcesGet.json + */ + /** + * Sample code: Gets a private link resource for cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getsAPrivateLinkResourceForCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.privateLinkResources().getWithResponse("TestGroup", "hsctestsg", "plr", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateLinkResourcesListByClusterSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateLinkResourcesListByClusterSamples.java new file mode 100644 index 0000000000000..1602cb2b777b1 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateLinkResourcesListByClusterSamples.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 PrivateLinkResources ListByCluster. */ +public final class PrivateLinkResourcesListByClusterSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateLinkResourceListByCluster.json + */ + /** + * Sample code: Gets the private link resources for cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getsThePrivateLinkResourcesForCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.privateLinkResources().listByCluster("TestResourceGroup", "hsctestsg", 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..2d55665171e58 --- /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/stable/2022-11-08/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..379130b7dbb89 --- /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/stable/2022-11-08/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/RolesListByClusterSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/RolesListByClusterSamples.java new file mode 100644 index 0000000000000..034b7e55d1c95 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/RolesListByClusterSamples.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 ListByCluster. */ +public final class RolesListByClusterSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/RoleListByCluster.json + */ + /** + * Sample code: RoleList. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void roleList(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.roles().listByCluster("TestGroup", "pgtestsvc4", Context.NONE); + } +} 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..153173e8d1cd2 --- /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/stable/2022-11-08/examples/ServerGet.json + */ + /** + * Sample code: Get the server of cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getTheServerOfCluster(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/ServersListByClusterSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServersListByClusterSamples.java new file mode 100644 index 0000000000000..1cee4aa7f106f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServersListByClusterSamples.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 ListByCluster. */ +public final class ServersListByClusterSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ServerListByCluster.json + */ + /** + * Sample code: List servers of the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void listServersOfTheCluster(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.servers().listByCluster("TestGroup", "hsctestsg1", Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/ci.yml b/sdk/postgresqlhsc/ci.yml new file mode 100644 index 0000000000000..15f23e3f1db7d --- /dev/null +++ b/sdk/postgresqlhsc/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/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 + +parameters: + - name: release_azureresourcemanagerpostgresqlhsc + displayName: azure-resourcemanager-postgresqlhsc + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: postgresqlhsc + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-postgresqlhsc + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerpostgresqlhsc + releaseInBatch: ${{ parameters.release_azureresourcemanagerpostgresqlhsc }} diff --git a/sdk/postgresqlhsc/pom.xml b/sdk/postgresqlhsc/pom.xml new file mode 100644 index 0000000000000..98096c2c22a10 --- /dev/null +++ b/sdk/postgresqlhsc/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-postgresqlhsc-service + pom + 1.0.0 + + + azure-resourcemanager-postgresqlhsc + +