diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 8d23ad4329578..041db9eda311b 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -411,6 +411,7 @@ com.azure.resourcemanager:azure-resourcemanager-paloaltonetworks-ngfw;1.0.0-beta com.azure.resourcemanager:azure-resourcemanager-newrelicobservability;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-qumulo;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-selfhelp;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 216e9f2ee0917..0a66d6067de4f 100644 --- a/pom.xml +++ b/pom.xml @@ -135,6 +135,7 @@ sdk/policyinsights sdk/postgresql sdk/postgresqlflexibleserver + sdk/postgresqlhsc sdk/powerbidedicated sdk/providerhub sdk/purview diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/CHANGELOG.md b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/CHANGELOG.md new file mode 100644 index 0000000000000..ff854871d1049 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-05-12) + +- Azure Resource Manager postgresqlhsc client library for Java. This package contains Microsoft Azure SDK for postgresqlhsc Management SDK. Azure Cosmos DB for PostgreSQL database service resource provider REST APIs. 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..ef9459527a010 --- /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. Azure Cosmos DB for PostgreSQL database service resource provider REST APIs. 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..4992f629b0275 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/SAMPLE.md @@ -0,0 +1,988 @@ +# Code snippets and samples + + +## Clusters + +- [CheckNameAvailability](#clusters_checknameavailability) +- [Create](#clusters_create) +- [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) +- [GetCoordinator](#configurations_getcoordinator) +- [GetNode](#configurations_getnode) +- [ListByCluster](#configurations_listbycluster) +- [ListByServer](#configurations_listbyserver) +- [UpdateOnCoordinator](#configurations_updateoncoordinator) +- [UpdateOnNode](#configurations_updateonnode) + +## 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) +- [Get](#roles_get) +- [ListByCluster](#roles_listbycluster) + +## Servers + +- [Get](#servers_get) +- [ListByCluster](#servers_listbycluster) +### Clusters_CheckNameAvailability + +```java +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"), com.azure.core.util.Context.NONE); + } +} +``` + +### Clusters_Create + +```java +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Clusters Create. */ +public final class ClustersCreateSamples { + /* + * 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("testcluster") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/sourcecluster") + .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("testcluster") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/source-cluster") + .withSourceLocation("westus") + .withPointInTimeUtc(OffsetDateTime.parse("2017-12-14T00:00:37.467Z")) + .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("testcluster") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withTags(mapOf()) + .withAdministratorLoginPassword("password") + .withPostgresqlVersion("15") + .withCitusVersion("11.1") + .withPreferredPrimaryZone("1") + .withEnableShardsOnCoordinator(false) + .withEnableHa(true) + .withCoordinatorServerEdition("GeneralPurpose") + .withCoordinatorStorageQuotaInMb(524288) + .withCoordinatorVCores(4) + .withCoordinatorEnablePublicIpAccess(true) + .withNodeServerEdition("MemoryOptimized") + .withNodeCount(3) + .withNodeStorageQuotaInMb(524288) + .withNodeVCores(8) + .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 +/** 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", com.azure.core.util.Context.NONE); + } +} +``` + +### Clusters_GetByResourceGroup + +```java +/** 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", "testcluster1", com.azure.core.util.Context.NONE); + } +} +``` + +### Clusters_List + +```java +/** 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(com.azure.core.util.Context.NONE); + } +} +``` + +### Clusters_ListByResourceGroup + +```java +/** 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", com.azure.core.util.Context.NONE); + } +} +``` + +### Clusters_PromoteReadReplica + +```java +/** 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 read replica cluster to an independent read-write cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void promoteReadReplicaClusterToAnIndependentReadWriteCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().promoteReadReplica("TestGroup", "testcluster1", com.azure.core.util.Context.NONE); + } +} +``` + +### Clusters_Restart + +```java +/** 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", "testcluster1", com.azure.core.util.Context.NONE); + } +} +``` + +### Clusters_Start + +```java +/** 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", "testcluster1", com.azure.core.util.Context.NONE); + } +} +``` + +### Clusters_Stop + +```java +/** 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", "testcluster1", com.azure.core.util.Context.NONE); + } +} +``` + +### Clusters_Update + +```java +import com.azure.resourcemanager.postgresqlhsc.models.Cluster; +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 up storage. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void scaleUpStorage(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + Cluster resource = + manager + .clusters() + .getByResourceGroupWithResponse("TestGroup", "testcluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withNodeStorageQuotaInMb(2097152).apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterUpdate.json + */ + /** + * Sample code: Update multiple configuration settings of the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateMultipleConfigurationSettingsOfTheCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + Cluster resource = + manager + .clusters() + .getByResourceGroupWithResponse("TestGroup", "testcluster", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withAdministratorLoginPassword("newpassword") + .withCoordinatorVCores(16) + .withNodeCount(4) + .withNodeVCores(16) + .apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterScaleCompute.json + */ + /** + * Sample code: Scale compute up or down. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void scaleComputeUpOrDown(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + Cluster resource = + manager + .clusters() + .getByResourceGroupWithResponse("TestGroup", "testcluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withNodeVCores(16).apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterAddNode.json + */ + /** + * Sample code: Scale out: Add new worker nodes. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void scaleOutAddNewWorkerNodes(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + Cluster resource = + manager + .clusters() + .getByResourceGroupWithResponse("TestGroup", "testcluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withNodeCount(2).apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterUpdateMaintenanceWindow.json + */ + /** + * Sample code: Update or define maintenance window. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateOrDefineMaintenanceWindow( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + Cluster resource = + manager + .clusters() + .getByResourceGroupWithResponse("TestGroup", "testcluster", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withMaintenanceWindow( + new MaintenanceWindow() + .withCustomWindow("Enabled") + .withStartHour(8) + .withStartMinute(0) + .withDayOfWeek(0)) + .apply(); + } +} +``` + +### Configurations_Get + +```java +/** 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", "testcluster", "client_encoding", com.azure.core.util.Context.NONE); + } +} +``` + +### Configurations_GetCoordinator + +```java +/** Samples for Configurations GetCoordinator. */ +public final class ConfigurationsGetCoordinatorSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationGetCoordinator.json + */ + /** + * Sample code: Get configuration details for coordinator. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getConfigurationDetailsForCoordinator( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .configurations() + .getCoordinatorWithResponse( + "TestResourceGroup", "testcluster", "array_nulls", com.azure.core.util.Context.NONE); + } +} +``` + +### Configurations_GetNode + +```java +/** Samples for Configurations GetNode. */ +public final class ConfigurationsGetNodeSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationGetNode.json + */ + /** + * Sample code: Get configuration details for node. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getConfigurationDetailsForNode( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .configurations() + .getNodeWithResponse("TestResourceGroup", "testcluster", "array_nulls", com.azure.core.util.Context.NONE); + } +} +``` + +### Configurations_ListByCluster + +```java +/** 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", "testcluster", com.azure.core.util.Context.NONE); + } +} +``` + +### Configurations_ListByServer + +```java +/** 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", "testcluster", "testserver", com.azure.core.util.Context.NONE); + } +} +``` + +### Configurations_UpdateOnCoordinator + +```java +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationInner; + +/** Samples for Configurations UpdateOnCoordinator. */ +public final class ConfigurationsUpdateOnCoordinatorSamples { + /* + * 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() + .updateOnCoordinator( + "TestResourceGroup", + "testcluster", + "array_nulls", + new ServerConfigurationInner().withValue("on"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Configurations_UpdateOnNode + +```java +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationInner; + +/** Samples for Configurations UpdateOnNode. */ +public final class ConfigurationsUpdateOnNodeSamples { + /* + * 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() + .updateOnNode( + "TestResourceGroup", + "testcluster", + "array_nulls", + new ServerConfigurationInner().withValue("off"), + com.azure.core.util.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 +/** 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", com.azure.core.util.Context.NONE); + } +} +``` + +### FirewallRules_Get + +```java +/** 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", com.azure.core.util.Context.NONE); + } +} +``` + +### FirewallRules_ListByCluster + +```java +/** 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", com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** 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(com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_CreateOrUpdate + +```java +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointServiceConnectionStatus; +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: Approves or Rejects a Private Endpoint Connection with a given name. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void approvesOrRejectsAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .privateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingServerGroupsv2("TestGroup", "testcluster") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} +``` + +### PrivateEndpointConnections_Delete + +```java +/** 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", "testcluster", "private-endpoint-connection-name", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Get + +```java +/** 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", "testcluster", "private-endpoint-connection-name", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_ListByCluster + +```java +/** 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", "testcluster", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkResources_Get + +```java +/** 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", "testcluster", "plr", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkResources_ListByCluster + +```java +/** 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", "testcluster", com.azure.core.util.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("password") + .create(); + } +} +``` + +### Roles_Delete + +```java +/** 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", com.azure.core.util.Context.NONE); + } +} +``` + +### Roles_Get + +```java +/** Samples for Roles Get. */ +public final class RolesGetSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/RoleGet.json + */ + /** + * Sample code: Get the role of the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getTheRoleOfTheCluster(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.roles().getWithResponse("TestGroup", "pgtestsvc4", "role1", com.azure.core.util.Context.NONE); + } +} +``` + +### Roles_ListByCluster + +```java +/** 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", com.azure.core.util.Context.NONE); + } +} +``` + +### Servers_Get + +```java +/** 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", "testcluster1", "testcluster1-c", com.azure.core.util.Context.NONE); + } +} +``` + +### Servers_ListByCluster + +```java +/** 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", "testcluster1", com.azure.core.util.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..dfe840ffc321f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-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. Azure Cosmos DB for PostgreSQL database service resource provider REST APIs. 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 + 0 + 0 + + + + com.azure + azure-core + 1.39.0 + + + com.azure + azure-core-management + 1.11.1 + + + 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..2ef665696dd2c --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/PostgresqlhscManager.java @@ -0,0 +1,395 @@ +// 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.stream.Collectors; + +/** Entry point to PostgresqlhscManager. Azure Cosmos DB for PostgreSQL database service resource provider REST APIs. */ +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(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 Cluster. + * + * @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 PrivateEndpointConnection. + * + * @return Resource collection API of PrivateEndpointConnections. + */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = + new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** + * Gets the resource collection API of PrivateLinkResources. + * + * @return Resource collection API of PrivateLinkResources. + */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** + * @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..cf284381a1f9f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/ClustersClient.java @@ -0,0 +1,510 @@ +// 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.ClusterInner; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.NameAvailabilityInner; +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 { + /** + * Lists all clusters in a 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(); + + /** + * Lists all clusters in a 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); + + /** + * Lists all clusters in a 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); + + /** + * Lists all clusters in a 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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClusterInner> beginCreate( + String resourceGroupName, String clusterName, ClusterInner 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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClusterInner> beginCreate( + String resourceGroupName, String clusterName, ClusterInner 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterInner create(String resourceGroupName, String clusterName, ClusterInner 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterInner create(String resourceGroupName, String clusterName, ClusterInner parameters, Context context); + + /** + * Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as + * cluster creation date and time. + * + * @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 such as compute and storage configuration and cluster lifecycle metadata such + * as cluster creation date and time along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String clusterName, Context context); + + /** + * Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as + * cluster creation date and time. + * + * @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 such as compute and storage configuration and cluster lifecycle metadata such + * as cluster creation date and time. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterInner 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 or several properties from the 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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClusterInner> beginUpdate( + String resourceGroupName, String clusterName, ClusterForUpdate parameters); + + /** + * Updates an existing cluster. The request body can contain one or several properties from the 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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClusterInner> beginUpdate( + String resourceGroupName, String clusterName, ClusterForUpdate parameters, Context context); + + /** + * Updates an existing cluster. The request body can contain one or several properties from the 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterInner update(String resourceGroupName, String clusterName, ClusterForUpdate parameters); + + /** + * Updates an existing cluster. The request body can contain one or several properties from the 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterInner update(String resourceGroupName, String clusterName, ClusterForUpdate parameters, Context context); + + /** + * Restarts all nodes in 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 all nodes in 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 all nodes in 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 all nodes in 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 stopped compute on all cluster nodes. + * + * @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 stopped compute on all cluster nodes. + * + * @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 stopped compute on all cluster nodes. + * + * @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 stopped compute on all cluster nodes. + * + * @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 compute on all cluster nodes. + * + * @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 compute on all cluster nodes. + * + * @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 compute on all cluster nodes. + * + * @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 compute on all cluster nodes. + * + * @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); + + /** + * Promotes read replica cluster to an independent read-write 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); + + /** + * Promotes read replica cluster to an independent read-write 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); + + /** + * Promotes read replica cluster to an independent read-write 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); + + /** + * Promotes read replica cluster to an independent read-write 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); + + /** + * Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most + * 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end + * with a hyphen. + * + * @param nameAvailabilityRequest The required parameters for checking if cluster 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 cluster name availability along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + NameAvailabilityRequest nameAvailabilityRequest, Context context); + + /** + * Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most + * 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end + * with a hyphen. + * + * @param nameAvailabilityRequest The required parameters for checking if cluster 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 cluster 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..60f8ca632e232 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/ConfigurationsClient.java @@ -0,0 +1,314 @@ +// 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; + +/** 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); + + /** + * Gets information of a configuration for coordinator. + * + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getCoordinatorWithResponse( + String resourceGroupName, String clusterName, String configurationName, Context context); + + /** + * Gets information of a configuration for coordinator. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerConfigurationInner getCoordinator(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> beginUpdateOnCoordinator( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner 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> beginUpdateOnCoordinator( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner 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 updateOnCoordinator( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner 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 updateOnCoordinator( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner parameters, + Context context); + + /** + * Gets information of a configuration for worker 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 worker nodes along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getNodeWithResponse( + String resourceGroupName, String clusterName, String configurationName, Context context); + + /** + * Gets information of a configuration for worker 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 worker nodes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerConfigurationInner getNode(String resourceGroupName, String clusterName, String configurationName); + + /** + * Updates configuration of worker 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> beginUpdateOnNode( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner parameters); + + /** + * Updates configuration of worker 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> beginUpdateOnNode( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner parameters, + Context context); + + /** + * Updates configuration of worker 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 updateOnNode( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner parameters); + + /** + * Updates configuration of worker 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 updateOnNode( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner 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..fe18b415dced3 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/CosmosDBForPostgreSql.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.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** 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. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the 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..54561ed6681b0 --- /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 cluster firewall rule or updates an existing 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 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 cluster firewall rule or updates an existing 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 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 cluster firewall rule or updates an existing 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 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 cluster firewall rule or updates an existing 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 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); + + /** + * Lists all the firewall rules on 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); + + /** + * Lists all the firewall rules on 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..c9a66dff88808 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,214 @@ +// 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.PrivateEndpointConnectionInner; + +/** 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 associated with 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 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 associated with 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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get( + String resourceGroupName, String clusterName, String privateEndpointConnectionName); + + /** + * Approves or Rejects 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 associated with the cluster. + * @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 the {@link SyncPoller} for polling of the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approves or Rejects 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 associated with the cluster. + * @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 the {@link SyncPoller} for polling of the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Approves or Rejects 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 associated with the cluster. + * @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 the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approves or Rejects 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 associated with the cluster. + * @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 the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with 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, 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 associated with 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, 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 associated with 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, 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 associated with 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, 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..bae33b407cbd9 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/RolesClient.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.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.RoleInner; + +/** An instance of this class provides access to all the operations defined in RolesClient. */ +public interface RolesClient { + /** + * Gets information about 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 information about a cluster role along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String clusterName, String roleName, Context context); + + /** + * Gets information about 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 information about a cluster role. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleInner get(String resourceGroupName, String clusterName, String roleName); + + /** + * 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/ClusterInner.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterInner.java new file mode 100644 index 0000000000000..409032101aa6b --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterInner.java @@ -0,0 +1,593 @@ +// 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.ServerNameItem; +import com.azure.resourcemanager.postgresqlhsc.models.SimplePrivateEndpointConnection; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Represents a cluster. */ +@Fluent +public final class ClusterInner extends Resource { + /* + * Properties of the cluster. + */ + @JsonProperty(value = "properties") + private ClusterProperties 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 ClusterInner class. */ + public ClusterInner() { + } + + /** + * Get the innerProperties property: Properties of the cluster. + * + * @return the innerProperties value. + */ + private ClusterProperties 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 ClusterInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ClusterInner 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(); + } + + /** + * 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 ClusterInner object itself. + */ + public ClusterInner withAdministratorLoginPassword(String administratorLoginPassword) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + 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 major PostgreSQL version on all cluster servers. + * + * @return the postgresqlVersion value. + */ + public String postgresqlVersion() { + return this.innerProperties() == null ? null : this.innerProperties().postgresqlVersion(); + } + + /** + * Set the postgresqlVersion property: The major PostgreSQL version on all cluster servers. + * + * @param postgresqlVersion the postgresqlVersion value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withPostgresqlVersion(String postgresqlVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withPostgresqlVersion(postgresqlVersion); + return this; + } + + /** + * Get the citusVersion property: The Citus extension version on all cluster servers. + * + * @return the citusVersion value. + */ + public String citusVersion() { + return this.innerProperties() == null ? null : this.innerProperties().citusVersion(); + } + + /** + * Set the citusVersion property: The Citus extension version on all cluster servers. + * + * @param citusVersion the citusVersion value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withCitusVersion(String citusVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + 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 ClusterInner object itself. + */ + public ClusterInner withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withMaintenanceWindow(maintenanceWindow); + return this; + } + + /** + * Get the preferredPrimaryZone property: Preferred primary availability zone (AZ) for all cluster servers. + * + * @return the preferredPrimaryZone value. + */ + public String preferredPrimaryZone() { + return this.innerProperties() == null ? null : this.innerProperties().preferredPrimaryZone(); + } + + /** + * Set the preferredPrimaryZone property: Preferred primary availability zone (AZ) for all cluster servers. + * + * @param preferredPrimaryZone the preferredPrimaryZone value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withPreferredPrimaryZone(String preferredPrimaryZone) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + 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 ClusterInner object itself. + */ + public ClusterInner withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withEnableShardsOnCoordinator(enableShardsOnCoordinator); + return this; + } + + /** + * Get the enableHa property: If high availability (HA) 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 (HA) is enabled or not for the cluster. + * + * @param enableHa the enableHa value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withEnableHa(Boolean enableHa) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withEnableHa(enableHa); + return this; + } + + /** + * Get the coordinatorServerEdition property: The edition of a coordinator server (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 a coordinator server (default: GeneralPurpose). + * Required for creation. + * + * @param coordinatorServerEdition the coordinatorServerEdition value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withCoordinatorServerEdition(String coordinatorServerEdition) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withCoordinatorServerEdition(coordinatorServerEdition); + return this; + } + + /** + * Get the coordinatorStorageQuotaInMb property: The storage of a server in MB. Required for creation. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @return the coordinatorStorageQuotaInMb value. + */ + public Integer coordinatorStorageQuotaInMb() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorStorageQuotaInMb(); + } + + /** + * Set the coordinatorStorageQuotaInMb property: The storage of a server in MB. Required for creation. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @param coordinatorStorageQuotaInMb the coordinatorStorageQuotaInMb value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withCoordinatorStorageQuotaInMb(Integer coordinatorStorageQuotaInMb) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withCoordinatorStorageQuotaInMb(coordinatorStorageQuotaInMb); + return this; + } + + /** + * Get the coordinatorVCores property: The vCores count of a server (max: 96). Required for creation. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @return the coordinatorVCores value. + */ + public Integer coordinatorVCores() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorVCores(); + } + + /** + * Set the coordinatorVCores property: The vCores count of a server (max: 96). Required for creation. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @param coordinatorVCores the coordinatorVCores value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withCoordinatorVCores(Integer coordinatorVCores) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withCoordinatorVCores(coordinatorVCores); + return this; + } + + /** + * Get the coordinatorEnablePublicIpAccess property: If public access is enabled on coordinator. + * + * @return the coordinatorEnablePublicIpAccess value. + */ + public Boolean coordinatorEnablePublicIpAccess() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorEnablePublicIpAccess(); + } + + /** + * Set the coordinatorEnablePublicIpAccess property: If public access is enabled on coordinator. + * + * @param coordinatorEnablePublicIpAccess the coordinatorEnablePublicIpAccess value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner 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 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 ClusterInner object itself. + */ + public ClusterInner 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 single node + * configuration with the ability to create distributed tables on that node. 2 or more worker nodes represent + * multi-node configuration. Node count value cannot be 1. Required for creation. + * + * @return the nodeCount value. + */ + public Integer 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 single node + * configuration with the ability to create distributed tables on that node. 2 or more worker nodes represent + * multi-node configuration. Node count value cannot be 1. Required for creation. + * + * @param nodeCount the nodeCount value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withNodeCount(Integer nodeCount) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withNodeCount(nodeCount); + return this; + } + + /** + * Get the nodeStorageQuotaInMb property: The storage in MB on each worker node. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @return the nodeStorageQuotaInMb value. + */ + public Integer nodeStorageQuotaInMb() { + return this.innerProperties() == null ? null : this.innerProperties().nodeStorageQuotaInMb(); + } + + /** + * Set the nodeStorageQuotaInMb property: The storage in MB on each worker node. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @param nodeStorageQuotaInMb the nodeStorageQuotaInMb value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withNodeStorageQuotaInMb(Integer nodeStorageQuotaInMb) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withNodeStorageQuotaInMb(nodeStorageQuotaInMb); + return this; + } + + /** + * Get the nodeVCores property: The compute in vCores on each worker node (max: 104). See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @return the nodeVCores value. + */ + public Integer nodeVCores() { + return this.innerProperties() == null ? null : this.innerProperties().nodeVCores(); + } + + /** + * Set the nodeVCores property: The compute in vCores on each worker node (max: 104). See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @param nodeVCores the nodeVCores value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withNodeVCores(Integer nodeVCores) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withNodeVCores(nodeVCores); + return this; + } + + /** + * Get the nodeEnablePublicIpAccess property: If public access is enabled on worker nodes. + * + * @return the nodeEnablePublicIpAccess value. + */ + public Boolean nodeEnablePublicIpAccess() { + return this.innerProperties() == null ? null : this.innerProperties().nodeEnablePublicIpAccess(); + } + + /** + * Set the nodeEnablePublicIpAccess property: If public access is enabled on worker nodes. + * + * @param nodeEnablePublicIpAccess the nodeEnablePublicIpAccess value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withNodeEnablePublicIpAccess(Boolean nodeEnablePublicIpAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withNodeEnablePublicIpAccess(nodeEnablePublicIpAccess); + return this; + } + + /** + * 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(); + } + + /** + * Set the sourceResourceId property: The resource id of source cluster for read replica clusters. + * + * @param sourceResourceId the sourceResourceId value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withSourceResourceId(String sourceResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withSourceResourceId(sourceResourceId); + return this; + } + + /** + * Get the sourceLocation property: The Azure region of source cluster for read replica clusters. + * + * @return the sourceLocation value. + */ + public String sourceLocation() { + return this.innerProperties() == null ? null : this.innerProperties().sourceLocation(); + } + + /** + * Set the sourceLocation property: The Azure region of source cluster for read replica clusters. + * + * @param sourceLocation the sourceLocation value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withSourceLocation(String sourceLocation) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withSourceLocation(sourceLocation); + return this; + } + + /** + * Get the pointInTimeUtc property: Date and time in UTC (ISO8601 format) for cluster restore. + * + * @return the pointInTimeUtc value. + */ + public OffsetDateTime pointInTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().pointInTimeUtc(); + } + + /** + * Set the pointInTimeUtc property: Date and time in UTC (ISO8601 format) for cluster restore. + * + * @param pointInTimeUtc the pointInTimeUtc value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withPointInTimeUtc(OffsetDateTime pointInTimeUtc) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withPointInTimeUtc(pointInTimeUtc); + return this; + } + + /** + * 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/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..8200ea81f4f7a --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterProperties.java @@ -0,0 +1,657 @@ +// 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.ServerNameItem; +import com.azure.resourcemanager.postgresqlhsc.models.SimplePrivateEndpointConnection; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of the cluster. */ +@Fluent +public final class ClusterProperties { + /* + * The administrator's login name of the servers in the cluster. + */ + @JsonProperty(value = "administratorLogin", access = JsonProperty.Access.WRITE_ONLY) + private String administratorLogin; + + /* + * The password of the administrator login. Required for creation. + */ + @JsonProperty(value = "administratorLoginPassword") + private String administratorLoginPassword; + + /* + * 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 major PostgreSQL version on all cluster servers. + */ + @JsonProperty(value = "postgresqlVersion") + private String postgresqlVersion; + + /* + * The Citus extension version on all cluster servers. + */ + @JsonProperty(value = "citusVersion") + private String citusVersion; + + /* + * Maintenance window of a cluster. + */ + @JsonProperty(value = "maintenanceWindow") + private MaintenanceWindow maintenanceWindow; + + /* + * Preferred primary availability zone (AZ) for all cluster servers. + */ + @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 (HA) is enabled or not for the cluster. + */ + @JsonProperty(value = "enableHa") + private Boolean enableHa; + + /* + * The edition of a coordinator server (default: GeneralPurpose). Required for creation. + */ + @JsonProperty(value = "coordinatorServerEdition") + private String coordinatorServerEdition; + + /* + * The storage of a server in MB. Required for creation. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + */ + @JsonProperty(value = "coordinatorStorageQuotaInMb") + private Integer coordinatorStorageQuotaInMb; + + /* + * The vCores count of a server (max: 96). Required for creation. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + */ + @JsonProperty(value = "coordinatorVCores") + private Integer coordinatorVCores; + + /* + * If public access is enabled on coordinator. + */ + @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. When node count is 0, it represents a single node configuration with the + * ability to create distributed tables on that node. 2 or more worker nodes represent multi-node configuration. + * Node count value cannot be 1. Required for creation. + */ + @JsonProperty(value = "nodeCount") + private Integer nodeCount; + + /* + * The storage in MB on each worker node. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + */ + @JsonProperty(value = "nodeStorageQuotaInMb") + private Integer nodeStorageQuotaInMb; + + /* + * The compute in vCores on each worker node (max: 104). See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + */ + @JsonProperty(value = "nodeVCores") + private Integer nodeVCores; + + /* + * If public access is enabled on worker nodes. + */ + @JsonProperty(value = "nodeEnablePublicIpAccess") + 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") + private String sourceResourceId; + + /* + * The Azure region of source cluster for read replica clusters. + */ + @JsonProperty(value = "sourceLocation") + private String sourceLocation; + + /* + * Date and time in UTC (ISO8601 format) for cluster restore. + */ + @JsonProperty(value = "pointInTimeUTC") + private OffsetDateTime pointInTimeUtc; + + /* + * 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 ClusterProperties class. */ + public ClusterProperties() { + } + + /** + * 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; + } + + /** + * 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 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 major PostgreSQL version on all cluster servers. + * + * @return the postgresqlVersion value. + */ + public String postgresqlVersion() { + return this.postgresqlVersion; + } + + /** + * Set the postgresqlVersion property: The major PostgreSQL version on all cluster servers. + * + * @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 extension version on all cluster servers. + * + * @return the citusVersion value. + */ + public String citusVersion() { + return this.citusVersion; + } + + /** + * Set the citusVersion property: The Citus extension version on all cluster servers. + * + * @param citusVersion the citusVersion value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties 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 ClusterProperties object itself. + */ + public ClusterProperties withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + this.maintenanceWindow = maintenanceWindow; + return this; + } + + /** + * Get the preferredPrimaryZone property: Preferred primary availability zone (AZ) for all cluster servers. + * + * @return the preferredPrimaryZone value. + */ + public String preferredPrimaryZone() { + return this.preferredPrimaryZone; + } + + /** + * Set the preferredPrimaryZone property: Preferred primary availability zone (AZ) for all cluster servers. + * + * @param preferredPrimaryZone the preferredPrimaryZone value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties 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 ClusterProperties object itself. + */ + public ClusterProperties withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) { + this.enableShardsOnCoordinator = enableShardsOnCoordinator; + return this; + } + + /** + * Get the enableHa property: If high availability (HA) is enabled or not for the cluster. + * + * @return the enableHa value. + */ + public Boolean enableHa() { + return this.enableHa; + } + + /** + * Set the enableHa property: If high availability (HA) 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 coordinatorServerEdition property: The edition of a coordinator server (default: GeneralPurpose). + * Required for creation. + * + * @return the coordinatorServerEdition value. + */ + public String coordinatorServerEdition() { + return this.coordinatorServerEdition; + } + + /** + * Set the coordinatorServerEdition property: The edition of a coordinator server (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 a server in MB. Required for creation. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @return the coordinatorStorageQuotaInMb value. + */ + public Integer coordinatorStorageQuotaInMb() { + return this.coordinatorStorageQuotaInMb; + } + + /** + * Set the coordinatorStorageQuotaInMb property: The storage of a server in MB. Required for creation. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @param coordinatorStorageQuotaInMb the coordinatorStorageQuotaInMb value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withCoordinatorStorageQuotaInMb(Integer coordinatorStorageQuotaInMb) { + this.coordinatorStorageQuotaInMb = coordinatorStorageQuotaInMb; + return this; + } + + /** + * Get the coordinatorVCores property: The vCores count of a server (max: 96). Required for creation. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @return the coordinatorVCores value. + */ + public Integer coordinatorVCores() { + return this.coordinatorVCores; + } + + /** + * Set the coordinatorVCores property: The vCores count of a server (max: 96). Required for creation. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @param coordinatorVCores the coordinatorVCores value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withCoordinatorVCores(Integer coordinatorVCores) { + this.coordinatorVCores = coordinatorVCores; + return this; + } + + /** + * Get the coordinatorEnablePublicIpAccess property: If public access is enabled on coordinator. + * + * @return the coordinatorEnablePublicIpAccess value. + */ + public Boolean coordinatorEnablePublicIpAccess() { + return this.coordinatorEnablePublicIpAccess; + } + + /** + * Set the coordinatorEnablePublicIpAccess property: If public access is enabled on 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 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 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 single node + * configuration with the ability to create distributed tables on that node. 2 or more worker nodes represent + * multi-node configuration. Node count value cannot be 1. Required for creation. + * + * @return the nodeCount value. + */ + public Integer nodeCount() { + return this.nodeCount; + } + + /** + * Set the nodeCount property: Worker node count of the cluster. When node count is 0, it represents a single node + * configuration with the ability to create distributed tables on that node. 2 or more worker nodes represent + * multi-node configuration. Node count value cannot be 1. Required for creation. + * + * @param nodeCount the nodeCount value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withNodeCount(Integer nodeCount) { + this.nodeCount = nodeCount; + return this; + } + + /** + * Get the nodeStorageQuotaInMb property: The storage in MB on each worker node. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @return the nodeStorageQuotaInMb value. + */ + public Integer nodeStorageQuotaInMb() { + return this.nodeStorageQuotaInMb; + } + + /** + * Set the nodeStorageQuotaInMb property: The storage in MB on each worker node. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @param nodeStorageQuotaInMb the nodeStorageQuotaInMb value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withNodeStorageQuotaInMb(Integer nodeStorageQuotaInMb) { + this.nodeStorageQuotaInMb = nodeStorageQuotaInMb; + return this; + } + + /** + * Get the nodeVCores property: The compute in vCores on each worker node (max: 104). See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @return the nodeVCores value. + */ + public Integer nodeVCores() { + return this.nodeVCores; + } + + /** + * Set the nodeVCores property: The compute in vCores on each worker node (max: 104). See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @param nodeVCores the nodeVCores value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withNodeVCores(Integer nodeVCores) { + this.nodeVCores = nodeVCores; + return this; + } + + /** + * Get the nodeEnablePublicIpAccess property: If public access is enabled on worker nodes. + * + * @return the nodeEnablePublicIpAccess value. + */ + public Boolean nodeEnablePublicIpAccess() { + return this.nodeEnablePublicIpAccess; + } + + /** + * Set the nodeEnablePublicIpAccess property: If public access is enabled on worker nodes. + * + * @param nodeEnablePublicIpAccess the nodeEnablePublicIpAccess value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withNodeEnablePublicIpAccess(Boolean nodeEnablePublicIpAccess) { + this.nodeEnablePublicIpAccess = nodeEnablePublicIpAccess; + return this; + } + + /** + * 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; + } + + /** + * Set the sourceResourceId property: The resource id of source cluster for read replica clusters. + * + * @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 Azure region of source cluster for read replica clusters. + * + * @return the sourceLocation value. + */ + public String sourceLocation() { + return this.sourceLocation; + } + + /** + * Set the sourceLocation property: The Azure region of source cluster for read replica clusters. + * + * @param sourceLocation the sourceLocation value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withSourceLocation(String sourceLocation) { + this.sourceLocation = sourceLocation; + return this; + } + + /** + * Get the pointInTimeUtc property: Date and time in UTC (ISO8601 format) for cluster restore. + * + * @return the pointInTimeUtc value. + */ + public OffsetDateTime pointInTimeUtc() { + return this.pointInTimeUtc; + } + + /** + * Set the pointInTimeUtc property: Date and time in UTC (ISO8601 format) for cluster restore. + * + * @param pointInTimeUtc the pointInTimeUtc value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withPointInTimeUtc(OffsetDateTime pointInTimeUtc) { + this.pointInTimeUtc = pointInTimeUtc; + return this; + } + + /** + * 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/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..4e9b2080b8bed --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterPropertiesForUpdate.java @@ -0,0 +1,442 @@ +// 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. Each cluster is created with pre-defined administrative role called + * ‘citus’. + */ + @JsonProperty(value = "administratorLoginPassword") + private String administratorLoginPassword; + + /* + * The major PostgreSQL version on all cluster servers. + */ + @JsonProperty(value = "postgresqlVersion") + private String postgresqlVersion; + + /* + * The Citus extension version on all cluster servers. + */ + @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 (HA) is enabled or not for the cluster. + */ + @JsonProperty(value = "enableHa") + private Boolean enableHa; + + /* + * Preferred primary availability zone (AZ) for all cluster servers. + */ + @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 Integer coordinatorStorageQuotaInMb; + + /* + * The vCores count of the coordinator (max: 96). + */ + @JsonProperty(value = "coordinatorVCores") + private Integer coordinatorVCores; + + /* + * If public access is enabled on 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 single node configuration with the + * ability to create distributed tables on that node. 2 or more worker nodes represent multi-node configuration. + * Node count value cannot be 1. + */ + @JsonProperty(value = "nodeCount") + private Integer nodeCount; + + /* + * The storage in MB on each worker node. + */ + @JsonProperty(value = "nodeStorageQuotaInMb") + private Integer nodeStorageQuotaInMb; + + /* + * The compute in vCores on each worker node (max: 104). + */ + @JsonProperty(value = "nodeVCores") + private Integer nodeVCores; + + /* + * If public access is enabled on worker nodes. + */ + @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. Each cluster is created + * with pre-defined administrative role called ‘citus’. . + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The password of the administrator login. Each cluster is created + * with pre-defined administrative role called ‘citus’. . + * + * @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 major PostgreSQL version on all cluster servers. + * + * @return the postgresqlVersion value. + */ + public String postgresqlVersion() { + return this.postgresqlVersion; + } + + /** + * Set the postgresqlVersion property: The major PostgreSQL version on all cluster servers. + * + * @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 extension version on all cluster servers. + * + * @return the citusVersion value. + */ + public String citusVersion() { + return this.citusVersion; + } + + /** + * Set the citusVersion property: The Citus extension version on all cluster servers. + * + * @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 (HA) is enabled or not for the cluster. + * + * @return the enableHa value. + */ + public Boolean enableHa() { + return this.enableHa; + } + + /** + * Set the enableHa property: If high availability (HA) 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 availability zone (AZ) for all cluster servers. + * + * @return the preferredPrimaryZone value. + */ + public String preferredPrimaryZone() { + return this.preferredPrimaryZone; + } + + /** + * Set the preferredPrimaryZone property: Preferred primary availability zone (AZ) for all cluster servers. + * + * @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 Integer 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(Integer coordinatorStorageQuotaInMb) { + this.coordinatorStorageQuotaInMb = coordinatorStorageQuotaInMb; + return this; + } + + /** + * Get the coordinatorVCores property: The vCores count of the coordinator (max: 96). + * + * @return the coordinatorVCores value. + */ + public Integer coordinatorVCores() { + return this.coordinatorVCores; + } + + /** + * Set the coordinatorVCores property: The vCores count of the coordinator (max: 96). + * + * @param coordinatorVCores the coordinatorVCores value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withCoordinatorVCores(Integer coordinatorVCores) { + this.coordinatorVCores = coordinatorVCores; + return this; + } + + /** + * Get the coordinatorEnablePublicIpAccess property: If public access is enabled on coordinator. + * + * @return the coordinatorEnablePublicIpAccess value. + */ + public Boolean coordinatorEnablePublicIpAccess() { + return this.coordinatorEnablePublicIpAccess; + } + + /** + * Set the coordinatorEnablePublicIpAccess property: If public access is enabled on 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 single node + * configuration with the ability to create distributed tables on that node. 2 or more worker nodes represent + * multi-node configuration. Node count value cannot be 1. + * + * @return the nodeCount value. + */ + public Integer nodeCount() { + return this.nodeCount; + } + + /** + * Set the nodeCount property: Worker node count of the cluster. When node count is 0, it represents a single node + * configuration with the ability to create distributed tables on that node. 2 or more worker nodes represent + * multi-node configuration. Node count value cannot be 1. + * + * @param nodeCount the nodeCount value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withNodeCount(Integer nodeCount) { + this.nodeCount = nodeCount; + return this; + } + + /** + * Get the nodeStorageQuotaInMb property: The storage in MB on each worker node. + * + * @return the nodeStorageQuotaInMb value. + */ + public Integer nodeStorageQuotaInMb() { + return this.nodeStorageQuotaInMb; + } + + /** + * Set the nodeStorageQuotaInMb property: The storage in MB on each worker node. + * + * @param nodeStorageQuotaInMb the nodeStorageQuotaInMb value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withNodeStorageQuotaInMb(Integer nodeStorageQuotaInMb) { + this.nodeStorageQuotaInMb = nodeStorageQuotaInMb; + return this; + } + + /** + * Get the nodeVCores property: The compute in vCores on each worker node (max: 104). + * + * @return the nodeVCores value. + */ + public Integer nodeVCores() { + return this.nodeVCores; + } + + /** + * Set the nodeVCores property: The compute in vCores on each worker node (max: 104). + * + * @param nodeVCores the nodeVCores value to set. + * @return the ClusterPropertiesForUpdate object itself. + */ + public ClusterPropertiesForUpdate withNodeVCores(Integer nodeVCores) { + this.nodeVCores = nodeVCores; + return this; + } + + /** + * Get the nodeEnablePublicIpAccess property: If public access is enabled on worker nodes. + * + * @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/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..6d52fc6673119 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ClusterServerInner.java @@ -0,0 +1,299 @@ +// 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 major PostgreSQL version of server. + * + * @return the postgresqlVersion value. + */ + public String postgresqlVersion() { + return this.innerProperties() == null ? null : this.innerProperties().postgresqlVersion(); + } + + /** + * Set the postgresqlVersion property: The major 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 extension version of server. + * + * @return the citusVersion value. + */ + public String citusVersion() { + return this.innerProperties() == null ? null : this.innerProperties().citusVersion(); + } + + /** + * Set the citusVersion property: The Citus extension 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 Integer 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(Integer 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. + * + * @return the vCores value. + */ + public Integer vCores() { + return this.innerProperties() == null ? null : this.innerProperties().vCores(); + } + + /** + * Set the vCores property: The vCores count of a server. + * + * @param vCores the vCores value to set. + * @return the ClusterServerInner object itself. + */ + public ClusterServerInner withVCores(Integer vCores) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterServerProperties(); + } + this.innerProperties().withVCores(vCores); + return this; + } + + /** + * Get the enableHa property: If high availability (HA) 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 (HA) 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 enablePublicIpAccess property: If public access is enabled on server. + * + * @return the enablePublicIpAccess value. + */ + public Boolean enablePublicIpAccess() { + return this.innerProperties() == null ? null : this.innerProperties().enablePublicIpAccess(); + } + + /** + * Get the isReadOnly property: If server database is set to read-only by system maintenance depending on high disk + * space usage. + * + * @return the isReadOnly value. + */ + public Boolean isReadOnly() { + return this.innerProperties() == null ? null : this.innerProperties().isReadOnly(); + } + + /** + * 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(); + } + + /** + * 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..03e6a1ad7a4a3 --- /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 major PostgreSQL version of server. + */ + @JsonProperty(value = "postgresqlVersion") + private String postgresqlVersion; + + /* + * The Citus extension 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 major PostgreSQL version of server. + * + * @return the postgresqlVersion value. + */ + public String postgresqlVersion() { + return this.postgresqlVersion; + } + + /** + * Set the postgresqlVersion property: The major 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 extension version of server. + * + * @return the citusVersion value. + */ + public String citusVersion() { + return this.citusVersion; + } + + /** + * Set the citusVersion property: The Citus extension 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(Integer storageQuotaInMb) { + super.withStorageQuotaInMb(storageQuotaInMb); + return this; + } + + /** {@inheritDoc} */ + @Override + public ClusterServerProperties withVCores(Integer 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..a05fd6b2ea0ee --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ConfigurationInner.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.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.ProvisioningState; +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; + } + + /** + * Get the provisioningState property: Provisioning state of the configuration. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/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..dd734c54f9b90 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ConfigurationProperties.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.ProvisioningState; +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; + + /* + * Provisioning state of the configuration + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** 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; + } + + /** + * Get the provisioningState property: Provisioning state of the configuration. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * 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..7477928c66a18 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/FirewallRuleInner.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.models.ProvisioningState; +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; + } + + /** + * Get the provisioningState property: Provisioning state of the firewall rule. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + 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..46f31f29c1334 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/FirewallRuleProperties.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.models.ProvisioningState; +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; + + /* + * Provisioning state of the firewall rule. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** 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; + } + + /** + * Get the provisioningState property: Provisioning state of the firewall rule. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * 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..17efa12a1017e --- /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 cluster name availability. */ +@Fluent +public final class NameAvailabilityInner { + /* + * Error message. + */ + @JsonProperty(value = "message") + private String message; + + /* + * Indicates whether the cluster 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 cluster name is available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: Indicates whether the cluster 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..b5502a2034eb2 --- /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/PrivateEndpointConnectionInner.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..65c3fb9577e1a --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateEndpointConnectionInner.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.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.PrivateEndpoint; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateLinkServiceConnectionState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The private endpoint connection resource. */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + /* + * Resource properties. + */ + @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 PrivateEndpointConnectionInner class. */ + public PrivateEndpointConnectionInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @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 groupIds property: The group ids for the private endpoint resource. + * + * @return the groupIds value. + */ + public List groupIds() { + return this.innerProperties() == null ? null : this.innerProperties().groupIds(); + } + + /** + * Get the privateEndpoint property: The private endpoint resource. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: The private endpoint resource. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/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..0f1a423376d4a --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpoint; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateLinkServiceConnectionState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of the private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionProperties { + /* + * The group ids for the private endpoint resource. + */ + @JsonProperty(value = "groupIds", access = JsonProperty.Access.WRITE_ONLY) + private List groupIds; + + /* + * The private endpoint resource. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpoint privateEndpoint; + + /* + * A collection of information about the state of the connection between service consumer and provider. + */ + @JsonProperty(value = "privateLinkServiceConnectionState", required = true) + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * The provisioning state of the private endpoint connection resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private PrivateEndpointConnectionProvisioningState provisioningState; + + /** Creates an instance of PrivateEndpointConnectionProperties class. */ + public PrivateEndpointConnectionProperties() { + } + + /** + * Get the groupIds property: The group ids for the private endpoint resource. + * + * @return the groupIds value. + */ + public List groupIds() { + return this.groupIds; + } + + /** + * Get the privateEndpoint property: The private endpoint resource. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: The private endpoint resource. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property privateLinkServiceConnectionState in model" + + " PrivateEndpointConnectionProperties")); + } else { + privateLinkServiceConnectionState().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionProperties.class); +} 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..923554014c4b7 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateEndpointConnectionSimpleProperties.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointProperty; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateLinkServiceConnectionState; +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; + + /* + * A collection of information about the state of the connection between service consumer and provider. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionState 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: A collection of information about the state of the connection + * between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionSimpleProperties object itself. + */ + public PrivateEndpointConnectionSimpleProperties withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState 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..0b7f876216cef --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateLinkResourceInner.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 { + /* + * Resource properties. + */ + @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: Resource properties. + * + * @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(); + } + + /** + * 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(); + } + + /** + * Get the requiredZoneNames property: The private link resource private link DNS zone name. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.innerProperties() == null ? null : this.innerProperties().requiredZoneNames(); + } + + /** + * Set the requiredZoneNames property: The private link resource private link DNS zone name. + * + * @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..2d27a23f50823 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/PrivateLinkResourceProperties.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /* + * The private link resource private link DNS zone name. + */ + @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; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: The private link resource private link DNS zone name. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Set the requiredZoneNames property: The private link resource private link DNS zone name. + * + * @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..3208249d60aca --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/RoleInner.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.models.ProvisioningState; +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", required = true) + private RoleProperties innerProperties = new RoleProperties(); + + /* + * 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; + } + + /** + * Get the provisioningState property: Provisioning state of the role. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property innerProperties in model RoleInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RoleInner.class); +} 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..0d559f30ae0fc --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/RoleProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlhsc.models.ProvisioningState; +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; + + /* + * Provisioning state of the role + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** 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; + } + + /** + * Get the provisioningState property: Provisioning state of the role. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * 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..5adc984d446ab --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerConfigurationInner.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.ProvisioningState; +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(); + } + + /** + * Get the provisioningState property: Provisioning state of the configuration. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/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..84a12ebe2c51c --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/ServerConfigurationProperties.java @@ -0,0 +1,166 @@ +// 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.ProvisioningState; +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", access = JsonProperty.Access.WRITE_ONLY) + private Boolean requiresRestart; + + /* + * Provisioning state of the configuration. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** 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; + } + + /** + * Get the provisioningState property: Provisioning state of the configuration. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * 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/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..35f087fea1112 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// 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. Azure Cosmos DB for PostgreSQL database service + * resource provider REST APIs. + */ +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..86173d74ef83a --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/fluent/package-info.java @@ -0,0 +1,9 @@ +// 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. Azure Cosmos DB for PostgreSQL database service + * resource provider REST APIs. + */ +package com.azure.resourcemanager.postgresqlhsc.fluent; diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClusterImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClusterImpl.java new file mode 100644 index 0000000000000..ce3530c3e915d --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClusterImpl.java @@ -0,0 +1,504 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.ClusterInner; +import com.azure.resourcemanager.postgresqlhsc.models.Cluster; +import com.azure.resourcemanager.postgresqlhsc.models.ClusterForUpdate; +import com.azure.resourcemanager.postgresqlhsc.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlhsc.models.ServerNameItem; +import com.azure.resourcemanager.postgresqlhsc.models.SimplePrivateEndpointConnection; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ClusterImpl implements Cluster, Cluster.Definition, Cluster.Update { + private ClusterInner 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 administratorLoginPassword() { + return this.innerModel().administratorLoginPassword(); + } + + 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 Integer coordinatorStorageQuotaInMb() { + return this.innerModel().coordinatorStorageQuotaInMb(); + } + + public Integer coordinatorVCores() { + return this.innerModel().coordinatorVCores(); + } + + public Boolean coordinatorEnablePublicIpAccess() { + return this.innerModel().coordinatorEnablePublicIpAccess(); + } + + public String nodeServerEdition() { + return this.innerModel().nodeServerEdition(); + } + + public Integer nodeCount() { + return this.innerModel().nodeCount(); + } + + public Integer nodeStorageQuotaInMb() { + return this.innerModel().nodeStorageQuotaInMb(); + } + + public Integer 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 OffsetDateTime pointInTimeUtc() { + return this.innerModel().pointInTimeUtc(); + } + + 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 ClusterInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String clusterName; + + private ClusterForUpdate updateParameters; + + public ClusterImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Cluster create() { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .create(resourceGroupName, clusterName, this.innerModel(), Context.NONE); + return this; + } + + public Cluster create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .create(resourceGroupName, clusterName, this.innerModel(), context); + return this; + } + + ClusterImpl(String name, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerObject = new ClusterInner(); + this.serviceManager = serviceManager; + this.clusterName = name; + } + + public ClusterImpl update() { + this.updateParameters = new ClusterForUpdate(); + return this; + } + + public Cluster apply() { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .update(resourceGroupName, clusterName, updateParameters, Context.NONE); + return this; + } + + public Cluster apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .update(resourceGroupName, clusterName, updateParameters, context); + return this; + } + + ClusterImpl(ClusterInner 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 Cluster refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .getByResourceGroupWithResponse(resourceGroupName, clusterName, Context.NONE) + .getValue(); + return this; + } + + public Cluster 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 ClusterImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ClusterImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ClusterImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ClusterImpl withAdministratorLoginPassword(String administratorLoginPassword) { + if (isInCreateMode()) { + this.innerModel().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } else { + this.updateParameters.withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + } + + public ClusterImpl withPostgresqlVersion(String postgresqlVersion) { + if (isInCreateMode()) { + this.innerModel().withPostgresqlVersion(postgresqlVersion); + return this; + } else { + this.updateParameters.withPostgresqlVersion(postgresqlVersion); + return this; + } + } + + public ClusterImpl withCitusVersion(String citusVersion) { + if (isInCreateMode()) { + this.innerModel().withCitusVersion(citusVersion); + return this; + } else { + this.updateParameters.withCitusVersion(citusVersion); + return this; + } + } + + public ClusterImpl withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + if (isInCreateMode()) { + this.innerModel().withMaintenanceWindow(maintenanceWindow); + return this; + } else { + this.updateParameters.withMaintenanceWindow(maintenanceWindow); + return this; + } + } + + public ClusterImpl withPreferredPrimaryZone(String preferredPrimaryZone) { + if (isInCreateMode()) { + this.innerModel().withPreferredPrimaryZone(preferredPrimaryZone); + return this; + } else { + this.updateParameters.withPreferredPrimaryZone(preferredPrimaryZone); + return this; + } + } + + public ClusterImpl withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator) { + if (isInCreateMode()) { + this.innerModel().withEnableShardsOnCoordinator(enableShardsOnCoordinator); + return this; + } else { + this.updateParameters.withEnableShardsOnCoordinator(enableShardsOnCoordinator); + return this; + } + } + + public ClusterImpl withEnableHa(Boolean enableHa) { + if (isInCreateMode()) { + this.innerModel().withEnableHa(enableHa); + return this; + } else { + this.updateParameters.withEnableHa(enableHa); + return this; + } + } + + public ClusterImpl withCoordinatorServerEdition(String coordinatorServerEdition) { + if (isInCreateMode()) { + this.innerModel().withCoordinatorServerEdition(coordinatorServerEdition); + return this; + } else { + this.updateParameters.withCoordinatorServerEdition(coordinatorServerEdition); + return this; + } + } + + public ClusterImpl withCoordinatorStorageQuotaInMb(Integer coordinatorStorageQuotaInMb) { + if (isInCreateMode()) { + this.innerModel().withCoordinatorStorageQuotaInMb(coordinatorStorageQuotaInMb); + return this; + } else { + this.updateParameters.withCoordinatorStorageQuotaInMb(coordinatorStorageQuotaInMb); + return this; + } + } + + public ClusterImpl withCoordinatorVCores(Integer coordinatorVCores) { + if (isInCreateMode()) { + this.innerModel().withCoordinatorVCores(coordinatorVCores); + return this; + } else { + this.updateParameters.withCoordinatorVCores(coordinatorVCores); + return this; + } + } + + public ClusterImpl withCoordinatorEnablePublicIpAccess(Boolean coordinatorEnablePublicIpAccess) { + if (isInCreateMode()) { + this.innerModel().withCoordinatorEnablePublicIpAccess(coordinatorEnablePublicIpAccess); + return this; + } else { + this.updateParameters.withCoordinatorEnablePublicIpAccess(coordinatorEnablePublicIpAccess); + return this; + } + } + + public ClusterImpl withNodeServerEdition(String nodeServerEdition) { + if (isInCreateMode()) { + this.innerModel().withNodeServerEdition(nodeServerEdition); + return this; + } else { + this.updateParameters.withNodeServerEdition(nodeServerEdition); + return this; + } + } + + public ClusterImpl withNodeCount(Integer nodeCount) { + if (isInCreateMode()) { + this.innerModel().withNodeCount(nodeCount); + return this; + } else { + this.updateParameters.withNodeCount(nodeCount); + return this; + } + } + + public ClusterImpl withNodeStorageQuotaInMb(Integer nodeStorageQuotaInMb) { + if (isInCreateMode()) { + this.innerModel().withNodeStorageQuotaInMb(nodeStorageQuotaInMb); + return this; + } else { + this.updateParameters.withNodeStorageQuotaInMb(nodeStorageQuotaInMb); + return this; + } + } + + public ClusterImpl withNodeVCores(Integer nodeVCores) { + if (isInCreateMode()) { + this.innerModel().withNodeVCores(nodeVCores); + return this; + } else { + this.updateParameters.withNodeVCores(nodeVCores); + return this; + } + } + + public ClusterImpl withNodeEnablePublicIpAccess(Boolean nodeEnablePublicIpAccess) { + this.innerModel().withNodeEnablePublicIpAccess(nodeEnablePublicIpAccess); + return this; + } + + public ClusterImpl withSourceResourceId(String sourceResourceId) { + this.innerModel().withSourceResourceId(sourceResourceId); + return this; + } + + public ClusterImpl withSourceLocation(String sourceLocation) { + this.innerModel().withSourceLocation(sourceLocation); + return this; + } + + public ClusterImpl withPointInTimeUtc(OffsetDateTime pointInTimeUtc) { + this.innerModel().withPointInTimeUtc(pointInTimeUtc); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClusterServerImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClusterServerImpl.java new file mode 100644 index 0000000000000..3e27519667f5f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClusterServerImpl.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.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 Integer storageQuotaInMb() { + return this.innerModel().storageQuotaInMb(); + } + + public Integer vCores() { + return this.innerModel().vCores(); + } + + public Boolean enableHa() { + return this.innerModel().enableHa(); + } + + public Boolean enablePublicIpAccess() { + return this.innerModel().enablePublicIpAccess(); + } + + public Boolean isReadOnly() { + return this.innerModel().isReadOnly(); + } + + public String administratorLogin() { + return this.innerModel().administratorLogin(); + } + + 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..d715e682b9ca6 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClustersClientImpl.java @@ -0,0 +1,2648 @@ +// 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.ClusterInner; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.NameAvailabilityInner; +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 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") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @BodyParam("application/json") ClusterInner 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") String 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({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("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({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("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") String 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") String 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") String 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") String 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") String subscriptionId, + @BodyParam("application/json") NameAvailabilityRequest nameAvailabilityRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all clusters in a 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())); + } + + /** + * Lists all clusters in a 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)); + } + + /** + * Lists all clusters in a 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)); + } + + /** + * Lists all clusters in a 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)); + } + + /** + * Lists all clusters in a 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()); + } + + /** + * Lists all clusters in a 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)); + } + + /** + * Lists all clusters in a 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())); + } + + /** + * Lists all clusters in a 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)); + } + + /** + * Lists all clusters in a 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)); + } + + /** + * Lists all clusters in a 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)); + } + + /** + * Lists all clusters in a 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)); + } + + /** + * Lists all clusters in a 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String clusterName, ClusterInner 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 + .create( + 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String clusterName, ClusterInner 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 + .create( + 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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClusterInner> beginCreateAsync( + String resourceGroupName, String clusterName, ClusterInner parameters) { + Mono>> mono = createWithResponseAsync(resourceGroupName, clusterName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ClusterInner.class, ClusterInner.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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClusterInner> beginCreateAsync( + String resourceGroupName, String clusterName, ClusterInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, clusterName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ClusterInner.class, ClusterInner.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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterInner> beginCreate( + String resourceGroupName, String clusterName, ClusterInner parameters) { + return this.beginCreateAsync(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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterInner> beginCreate( + String resourceGroupName, String clusterName, ClusterInner parameters, Context context) { + return this.beginCreateAsync(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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String clusterName, ClusterInner parameters) { + return beginCreateAsync(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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String clusterName, ClusterInner parameters, Context context) { + return beginCreateAsync(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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterInner create(String resourceGroupName, String clusterName, ClusterInner parameters) { + return createAsync(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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterInner create(String resourceGroupName, String clusterName, ClusterInner parameters, Context context) { + return createAsync(resourceGroupName, clusterName, parameters, context).block(); + } + + /** + * Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as + * cluster creation date and time. + * + * @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 such as compute and storage configuration and cluster lifecycle metadata such + * as cluster creation date and time 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 such as compute and storage configuration and cluster lifecycle metadata such as + * cluster creation date and time. + * + * @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 such as compute and storage configuration and cluster lifecycle metadata such + * as cluster creation date and time 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 such as compute and storage configuration and cluster lifecycle metadata such as + * cluster creation date and time. + * + * @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 such as compute and storage configuration and cluster lifecycle metadata such + * as cluster creation date and time 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 such as compute and storage configuration and cluster lifecycle metadata such as + * cluster creation date and time. + * + * @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 such as compute and storage configuration and cluster lifecycle metadata such + * as cluster creation date and time 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 such as compute and storage configuration and cluster lifecycle metadata such as + * cluster creation date and time. + * + * @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 such as compute and storage configuration and cluster lifecycle metadata such + * as cluster creation date and time. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterInner 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 this.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 this.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 or several properties from the 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 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 or several properties from the 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 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 or several properties from the 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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClusterInner> beginUpdateAsync( + String resourceGroupName, String clusterName, ClusterForUpdate parameters) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, clusterName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ClusterInner.class, ClusterInner.class, this.client.getContext()); + } + + /** + * Updates an existing cluster. The request body can contain one or several properties from the 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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClusterInner> 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(), ClusterInner.class, ClusterInner.class, context); + } + + /** + * Updates an existing cluster. The request body can contain one or several properties from the 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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterInner> beginUpdate( + String resourceGroupName, String clusterName, ClusterForUpdate parameters) { + return this.beginUpdateAsync(resourceGroupName, clusterName, parameters).getSyncPoller(); + } + + /** + * Updates an existing cluster. The request body can contain one or several properties from the 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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterInner> beginUpdate( + String resourceGroupName, String clusterName, ClusterForUpdate parameters, Context context) { + return this.beginUpdateAsync(resourceGroupName, clusterName, parameters, context).getSyncPoller(); + } + + /** + * Updates an existing cluster. The request body can contain one or several properties from the 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 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 or several properties from the 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 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 or several properties from the 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterInner update(String resourceGroupName, String clusterName, ClusterForUpdate parameters) { + return updateAsync(resourceGroupName, clusterName, parameters).block(); + } + + /** + * Updates an existing cluster. The request body can contain one or several properties from the 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterInner update( + String resourceGroupName, String clusterName, ClusterForUpdate parameters, Context context) { + return updateAsync(resourceGroupName, clusterName, parameters, context).block(); + } + + /** + * Restarts all nodes in 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 all nodes in 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 all nodes in 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 all nodes in 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 all nodes in 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 this.beginRestartAsync(resourceGroupName, clusterName).getSyncPoller(); + } + + /** + * Restarts all nodes in 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 this.beginRestartAsync(resourceGroupName, clusterName, context).getSyncPoller(); + } + + /** + * Restarts all nodes in 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 all nodes in 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 all nodes in 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 all nodes in 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 stopped compute on all cluster nodes. + * + * @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 stopped compute on all cluster nodes. + * + * @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 stopped compute on all cluster nodes. + * + * @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 stopped compute on all cluster nodes. + * + * @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 stopped compute on all cluster nodes. + * + * @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 this.beginStartAsync(resourceGroupName, clusterName).getSyncPoller(); + } + + /** + * Starts stopped compute on all cluster nodes. + * + * @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 this.beginStartAsync(resourceGroupName, clusterName, context).getSyncPoller(); + } + + /** + * Starts stopped compute on all cluster nodes. + * + * @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 stopped compute on all cluster nodes. + * + * @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 stopped compute on all cluster nodes. + * + * @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 stopped compute on all cluster nodes. + * + * @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 compute on all cluster nodes. + * + * @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 compute on all cluster nodes. + * + * @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 compute on all cluster nodes. + * + * @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 compute on all cluster nodes. + * + * @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 compute on all cluster nodes. + * + * @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 this.beginStopAsync(resourceGroupName, clusterName).getSyncPoller(); + } + + /** + * Stops compute on all cluster nodes. + * + * @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 this.beginStopAsync(resourceGroupName, clusterName, context).getSyncPoller(); + } + + /** + * Stops compute on all cluster nodes. + * + * @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 compute on all cluster nodes. + * + * @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 compute on all cluster nodes. + * + * @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 compute on all cluster nodes. + * + * @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(); + } + + /** + * Promotes read replica cluster to an independent read-write 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())); + } + + /** + * Promotes read replica cluster to an independent read-write 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); + } + + /** + * Promotes read replica cluster to an independent read-write 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()); + } + + /** + * Promotes read replica cluster to an independent read-write 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); + } + + /** + * Promotes read replica cluster to an independent read-write 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 this.beginPromoteReadReplicaAsync(resourceGroupName, clusterName).getSyncPoller(); + } + + /** + * Promotes read replica cluster to an independent read-write 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 this.beginPromoteReadReplicaAsync(resourceGroupName, clusterName, context).getSyncPoller(); + } + + /** + * Promotes read replica cluster to an independent read-write 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); + } + + /** + * Promotes read replica cluster to an independent read-write 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); + } + + /** + * Promotes read replica cluster to an independent read-write 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(); + } + + /** + * Promotes read replica cluster to an independent read-write 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(); + } + + /** + * Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most + * 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end + * with a hyphen. + * + * @param nameAvailabilityRequest The required parameters for checking if cluster 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 cluster 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())); + } + + /** + * Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most + * 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end + * with a hyphen. + * + * @param nameAvailabilityRequest The required parameters for checking if cluster 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 cluster 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); + } + + /** + * Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most + * 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end + * with a hyphen. + * + * @param nameAvailabilityRequest The required parameters for checking if cluster 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 cluster 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())); + } + + /** + * Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most + * 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end + * with a hyphen. + * + * @param nameAvailabilityRequest The required parameters for checking if cluster 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 cluster name availability along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + NameAvailabilityRequest nameAvailabilityRequest, Context context) { + return checkNameAvailabilityWithResponseAsync(nameAvailabilityRequest, context).block(); + } + + /** + * Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most + * 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end + * with a hyphen. + * + * @param nameAvailabilityRequest The required parameters for checking if cluster 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 cluster 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..652853039071b --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ClustersImpl.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.ClusterInner; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.postgresqlhsc.models.Cluster; +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 ClusterImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ClusterImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ClusterImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ClusterImpl(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 ClusterImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Cluster getByResourceGroup(String resourceGroupName, String clusterName) { + ClusterInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, clusterName); + if (inner != null) { + return new ClusterImpl(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 Cluster 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 ClusterImpl define(String name) { + return new ClusterImpl(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..572c19ae82bf6 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ConfigurationImpl.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.ProvisioningState; +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 ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + 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..3e9784f71ecbb --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ConfigurationsClientImpl.java @@ -0,0 +1,1836 @@ +// 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 java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ConfigurationsClient. */ +public final class ConfigurationsClientImpl implements ConfigurationsClient { + /** The proxy service used to perform REST calls. */ + private final ConfigurationsService service; + + /** The service client containing this operation class. */ + private final 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") String 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") String 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") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("configurationName") String configurationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/coordinatorConfigurations/{configurationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getCoordinator( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String 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}/coordinatorConfigurations/{configurationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateOnCoordinator( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("configurationName") String configurationName, + @BodyParam("application/json") ServerConfigurationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/nodeConfigurations/{configurationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getNode( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String 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}/nodeConfigurations/{configurationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateOnNode( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("configurationName") String configurationName, + @BodyParam("application/json") ServerConfigurationInner 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(); + } + + /** + * Gets information of a configuration for coordinator. + * + * @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCoordinatorWithResponseAsync( + 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 + .getCoordinator( + 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. + * + * @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCoordinatorWithResponseAsync( + 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 + .getCoordinator( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + configurationName, + accept, + context); + } + + /** + * Gets information of a configuration for coordinator. + * + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getCoordinatorAsync( + String resourceGroupName, String clusterName, String configurationName) { + return getCoordinatorWithResponseAsync(resourceGroupName, clusterName, configurationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets information of a configuration for coordinator. + * + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCoordinatorWithResponse( + String resourceGroupName, String clusterName, String configurationName, Context context) { + return getCoordinatorWithResponseAsync(resourceGroupName, clusterName, configurationName, context).block(); + } + + /** + * Gets information of a configuration for coordinator. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerConfigurationInner getCoordinator( + String resourceGroupName, String clusterName, String configurationName) { + return getCoordinatorWithResponse(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>> updateOnCoordinatorWithResponseAsync( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner 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 + .updateOnCoordinator( + 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>> updateOnCoordinatorWithResponseAsync( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner 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 + .updateOnCoordinator( + 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> beginUpdateOnCoordinatorAsync( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner parameters) { + Mono>> mono = + updateOnCoordinatorWithResponseAsync(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> beginUpdateOnCoordinatorAsync( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateOnCoordinatorWithResponseAsync( + 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> beginUpdateOnCoordinator( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner parameters) { + return this + .beginUpdateOnCoordinatorAsync(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> beginUpdateOnCoordinator( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner parameters, + Context context) { + return this + .beginUpdateOnCoordinatorAsync(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 updateOnCoordinatorAsync( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner parameters) { + return beginUpdateOnCoordinatorAsync(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 updateOnCoordinatorAsync( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner parameters, + Context context) { + return beginUpdateOnCoordinatorAsync(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 updateOnCoordinator( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner parameters) { + return updateOnCoordinatorAsync(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 updateOnCoordinator( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner parameters, + Context context) { + return updateOnCoordinatorAsync(resourceGroupName, clusterName, configurationName, parameters, context).block(); + } + + /** + * Gets information of a configuration for worker 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 worker nodes along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getNodeWithResponseAsync( + 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 + .getNode( + 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 worker 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 worker nodes along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getNodeWithResponseAsync( + 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 + .getNode( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + configurationName, + accept, + context); + } + + /** + * Gets information of a configuration for worker 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 worker nodes on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getNodeAsync( + String resourceGroupName, String clusterName, String configurationName) { + return getNodeWithResponseAsync(resourceGroupName, clusterName, configurationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets information of a configuration for worker 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 worker nodes along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNodeWithResponse( + String resourceGroupName, String clusterName, String configurationName, Context context) { + return getNodeWithResponseAsync(resourceGroupName, clusterName, configurationName, context).block(); + } + + /** + * Gets information of a configuration for worker 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 worker nodes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerConfigurationInner getNode(String resourceGroupName, String clusterName, String configurationName) { + return getNodeWithResponse(resourceGroupName, clusterName, configurationName, Context.NONE).getValue(); + } + + /** + * Updates configuration of worker 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>> updateOnNodeWithResponseAsync( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner 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 + .updateOnNode( + 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 worker 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>> updateOnNodeWithResponseAsync( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner 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 + .updateOnNode( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + configurationName, + parameters, + accept, + context); + } + + /** + * Updates configuration of worker 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> beginUpdateOnNodeAsync( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner parameters) { + Mono>> mono = + updateOnNodeWithResponseAsync(resourceGroupName, clusterName, configurationName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerConfigurationInner.class, + ServerConfigurationInner.class, + this.client.getContext()); + } + + /** + * Updates configuration of worker 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> beginUpdateOnNodeAsync( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateOnNodeWithResponseAsync(resourceGroupName, clusterName, configurationName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerConfigurationInner.class, + ServerConfigurationInner.class, + context); + } + + /** + * Updates configuration of worker 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> beginUpdateOnNode( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner parameters) { + return this + .beginUpdateOnNodeAsync(resourceGroupName, clusterName, configurationName, parameters) + .getSyncPoller(); + } + + /** + * Updates configuration of worker 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> beginUpdateOnNode( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner parameters, + Context context) { + return this + .beginUpdateOnNodeAsync(resourceGroupName, clusterName, configurationName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates configuration of worker 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 updateOnNodeAsync( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner parameters) { + return beginUpdateOnNodeAsync(resourceGroupName, clusterName, configurationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates configuration of worker 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 updateOnNodeAsync( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner parameters, + Context context) { + return beginUpdateOnNodeAsync(resourceGroupName, clusterName, configurationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates configuration of worker 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 updateOnNode( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner parameters) { + return updateOnNodeAsync(resourceGroupName, clusterName, configurationName, parameters).block(); + } + + /** + * Updates configuration of worker 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 updateOnNode( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner parameters, + Context context) { + return updateOnNodeAsync(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..93bd4fd461ecb --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ConfigurationsImpl.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.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; + +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 Response getCoordinatorWithResponse( + String resourceGroupName, String clusterName, String configurationName, Context context) { + Response inner = + this.serviceClient().getCoordinatorWithResponse(resourceGroupName, clusterName, configurationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerConfiguration getCoordinator(String resourceGroupName, String clusterName, String configurationName) { + ServerConfigurationInner inner = + this.serviceClient().getCoordinator(resourceGroupName, clusterName, configurationName); + if (inner != null) { + return new ServerConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerConfiguration updateOnCoordinator( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner parameters) { + ServerConfigurationInner inner = + this.serviceClient().updateOnCoordinator(resourceGroupName, clusterName, configurationName, parameters); + if (inner != null) { + return new ServerConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerConfiguration updateOnCoordinator( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner parameters, + Context context) { + ServerConfigurationInner inner = + this + .serviceClient() + .updateOnCoordinator(resourceGroupName, clusterName, configurationName, parameters, context); + if (inner != null) { + return new ServerConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getNodeWithResponse( + String resourceGroupName, String clusterName, String configurationName, Context context) { + Response inner = + this.serviceClient().getNodeWithResponse(resourceGroupName, clusterName, configurationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerConfiguration getNode(String resourceGroupName, String clusterName, String configurationName) { + ServerConfigurationInner inner = + this.serviceClient().getNode(resourceGroupName, clusterName, configurationName); + if (inner != null) { + return new ServerConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerConfiguration updateOnNode( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner parameters) { + ServerConfigurationInner inner = + this.serviceClient().updateOnNode(resourceGroupName, clusterName, configurationName, parameters); + if (inner != null) { + return new ServerConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerConfiguration updateOnNode( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner parameters, + Context context) { + ServerConfigurationInner inner = + this.serviceClient().updateOnNode(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..8ceaaa41685cf --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/CosmosDBForPostgreSqlBuilder.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.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the CosmosDBForPostgreSqlImpl type. */ +@ServiceClientBuilder(serviceClients = {CosmosDBForPostgreSqlImpl.class}) +public final class CosmosDBForPostgreSqlBuilder { + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String 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(String 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..d5f529352621f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/CosmosDBForPostgreSqlImpl.java @@ -0,0 +1,388 @@ +// 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 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 String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The 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, + String 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..58b378566633f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/FirewallRuleImpl.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; +import com.azure.resourcemanager.postgresqlhsc.models.ProvisioningState; + +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 ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + 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..ebbf0788a6347 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/FirewallRulesClientImpl.java @@ -0,0 +1,1018 @@ +// 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 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({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String 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") String 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") String 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") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a new cluster firewall rule or updates an existing 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 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 cluster firewall rule or updates an existing 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 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 cluster firewall rule or updates an existing 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 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 cluster firewall rule or updates an existing 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 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 cluster firewall rule or updates an existing 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 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 this + .beginCreateOrUpdateAsync(resourceGroupName, clusterName, firewallRuleName, parameters) + .getSyncPoller(); + } + + /** + * Creates a new cluster firewall rule or updates an existing 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 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 this + .beginCreateOrUpdateAsync(resourceGroupName, clusterName, firewallRuleName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates a new cluster firewall rule or updates an existing 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 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 cluster firewall rule or updates an existing 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 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 cluster firewall rule or updates an existing 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 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 cluster firewall rule or updates an existing 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 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 this.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 this.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(); + } + + /** + * Lists all the firewall rules on 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())); + } + + /** + * Lists all the firewall rules on 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)); + } + + /** + * Lists all the firewall rules on 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)); + } + + /** + * Lists all the firewall rules on 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)); + } + + /** + * Lists all the firewall rules on 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)); + } + + /** + * Lists all the firewall rules on 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/PrivateEndpointConnectionImpl.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..f11cd5461f6d5 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateEndpointConnectionImpl.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.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpoint; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnection; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateLinkServiceConnectionState; +import java.util.Collections; +import java.util.List; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private PrivateEndpointConnectionInner 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 List groupIds() { + List inner = this.innerModel().groupIds(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PrivateEndpoint privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String clusterName; + + private String privateEndpointConnectionName; + + public PrivateEndpointConnectionImpl withExistingServerGroupsv2(String resourceGroupName, String clusterName) { + this.resourceGroupName = resourceGroupName; + this.clusterName = clusterName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, clusterName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, clusterName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + String name, com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionImpl update() { + return this; + } + + public PrivateEndpointConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, clusterName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, clusterName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + PrivateEndpointConnectionInner 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 PrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, clusterName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, clusterName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.innerModel().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } +} 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..c3c739aced967 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1064 @@ +// 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.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnectionListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + /** The proxy service used to perform REST calls. */ + private final PrivateEndpointConnectionsService service; + + /** The service client containing this operation class. */ + private final 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") String 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") String 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({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @BodyParam("application/json") PrivateEndpointConnectionInner 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") String 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 associated with 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 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 associated with 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 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 associated with 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 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 associated with 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 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 associated with 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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get( + String resourceGroupName, String clusterName, String privateEndpointConnectionName) { + return getWithResponse(resourceGroupName, clusterName, privateEndpointConnectionName, Context.NONE).getValue(); + } + + /** + * Approves or Rejects 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 associated with the cluster. + * @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 the private endpoint connection resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (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())); + } + + /** + * Approves or Rejects 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 associated with the cluster. + * @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 the private endpoint connection resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (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); + } + + /** + * Approves or Rejects 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 associated with the cluster. + * @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 the {@link PollerFlux} for polling of the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, clusterName, privateEndpointConnectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + this.client.getContext()); + } + + /** + * Approves or Rejects 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 associated with the cluster. + * @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 the {@link PollerFlux} for polling of the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, clusterName, privateEndpointConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Approves or Rejects 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 associated with the cluster. + * @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 the {@link SyncPoller} for polling of the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, clusterName, privateEndpointConnectionName, parameters) + .getSyncPoller(); + } + + /** + * Approves or Rejects 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 associated with the cluster. + * @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 the {@link SyncPoller} for polling of the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return this + .beginCreateOrUpdateAsync( + resourceGroupName, clusterName, privateEndpointConnectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Approves or Rejects 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 associated with the cluster. + * @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 the private endpoint connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, clusterName, privateEndpointConnectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approves or Rejects 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 associated with the cluster. + * @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 the private endpoint connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, clusterName, privateEndpointConnectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approves or Rejects 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 associated with the cluster. + * @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 the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return createOrUpdateAsync(resourceGroupName, clusterName, privateEndpointConnectionName, parameters).block(); + } + + /** + * Approves or Rejects 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 associated with the cluster. + * @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 the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String clusterName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, clusterName, privateEndpointConnectionName, parameters, context) + .block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with 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, 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 associated with 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, 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 associated with 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, 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 associated with 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, 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 associated with 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, String privateEndpointConnectionName) { + return this.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 associated with 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, String privateEndpointConnectionName, Context context) { + return this + .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 associated with 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, 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 associated with 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, 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 associated with 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, 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 associated with 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, 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..413b872ef3afe --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,214 @@ +// 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.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointConnection; +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 PrivateEndpointConnectionImpl(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 PrivateEndpointConnectionImpl(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 PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateEndpointConnection get( + String resourceGroupName, String clusterName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this.serviceClient().get(resourceGroupName, clusterName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(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 PrivateEndpointConnection getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String 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 PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(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..94dfad542304c --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,417 @@ +// 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 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") String 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") String 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..21bc1612c4390 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/RoleImpl.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.ProvisioningState; +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 ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + 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 Role refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getRoles() + .getWithResponse(resourceGroupName, clusterName, roleName, Context.NONE) + .getValue(); + return this; + } + + public Role refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRoles() + .getWithResponse(resourceGroupName, clusterName, roleName, context) + .getValue(); + return this; + } + + 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..1daf13989b703 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/RolesClientImpl.java @@ -0,0 +1,975 @@ +// 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 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"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/roles/{roleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("roleName") String roleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/roles/{roleName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String 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") String 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") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets information about 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 information about a cluster role along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + roleName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about 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 information about a cluster role along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + roleName, + accept, + context); + } + + /** + * Gets information about 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 information about a cluster role on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String clusterName, String roleName) { + return getWithResponseAsync(resourceGroupName, clusterName, roleName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets information about 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 information about a cluster role along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String clusterName, String roleName, Context context) { + return getWithResponseAsync(resourceGroupName, clusterName, roleName, context).block(); + } + + /** + * Gets information about 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 information about a cluster role. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleInner get(String resourceGroupName, String clusterName, String roleName) { + return getWithResponse(resourceGroupName, clusterName, roleName, Context.NONE).getValue(); + } + + /** + * 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 this.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 this.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 this.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 this.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..3fb382f79c80d --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/RolesImpl.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.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 Response getWithResponse( + String resourceGroupName, String clusterName, String roleName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, clusterName, roleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RoleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Role get(String resourceGroupName, String clusterName, String roleName) { + RoleInner inner = this.serviceClient().get(resourceGroupName, clusterName, roleName); + if (inner != null) { + return new RoleImpl(inner, this.manager()); + } else { + return null; + } + } + + 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 Role 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 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))); + } + return this.getWithResponse(resourceGroupName, clusterName, roleName, 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 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))); + } + return this.getWithResponse(resourceGroupName, clusterName, roleName, 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 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..899c65d6763c7 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServerConfigurationImpl.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.ProvisioningState; +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 ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + 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..3a88fe916bbe0 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/ServersClientImpl.java @@ -0,0 +1,410 @@ +// 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 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") String 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") String 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..8abb659635224 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/implementation/package-info.java @@ -0,0 +1,9 @@ +// 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. Azure Cosmos DB for PostgreSQL database service + * resource provider REST APIs. + */ +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..ebb8f8c4cf326 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Cluster.java @@ -0,0 +1,872 @@ +// 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.ClusterInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Cluster. */ +public interface Cluster { + /** + * 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 administratorLoginPassword property: The password of the administrator login. Required for creation. + * + * @return the administratorLoginPassword value. + */ + String administratorLoginPassword(); + + /** + * 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 major PostgreSQL version on all cluster servers. + * + * @return the postgresqlVersion value. + */ + String postgresqlVersion(); + + /** + * Gets the citusVersion property: The Citus extension version on all cluster servers. + * + * @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 availability zone (AZ) for all cluster servers. + * + * @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 (HA) is enabled or not for the cluster. + * + * @return the enableHa value. + */ + Boolean enableHa(); + + /** + * Gets the coordinatorServerEdition property: The edition of a coordinator server (default: GeneralPurpose). + * Required for creation. + * + * @return the coordinatorServerEdition value. + */ + String coordinatorServerEdition(); + + /** + * Gets the coordinatorStorageQuotaInMb property: The storage of a server in MB. Required for creation. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @return the coordinatorStorageQuotaInMb value. + */ + Integer coordinatorStorageQuotaInMb(); + + /** + * Gets the coordinatorVCores property: The vCores count of a server (max: 96). Required for creation. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @return the coordinatorVCores value. + */ + Integer coordinatorVCores(); + + /** + * Gets the coordinatorEnablePublicIpAccess property: If public access is enabled on coordinator. + * + * @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. When node count is 0, it represents a single node + * configuration with the ability to create distributed tables on that node. 2 or more worker nodes represent + * multi-node configuration. Node count value cannot be 1. Required for creation. + * + * @return the nodeCount value. + */ + Integer nodeCount(); + + /** + * Gets the nodeStorageQuotaInMb property: The storage in MB on each worker node. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @return the nodeStorageQuotaInMb value. + */ + Integer nodeStorageQuotaInMb(); + + /** + * Gets the nodeVCores property: The compute in vCores on each worker node (max: 104). See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * + * @return the nodeVCores value. + */ + Integer nodeVCores(); + + /** + * Gets the nodeEnablePublicIpAccess property: If public access is enabled on worker nodes. + * + * @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 Azure region of source cluster for read replica clusters. + * + * @return the sourceLocation value. + */ + String sourceLocation(); + + /** + * Gets the pointInTimeUtc property: Date and time in UTC (ISO8601 format) for cluster restore. + * + * @return the pointInTimeUtc value. + */ + OffsetDateTime pointInTimeUtc(); + + /** + * 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.ClusterInner object. + * + * @return the inner object. + */ + ClusterInner innerModel(); + + /** The entirety of the Cluster definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Cluster definition stages. */ + interface DefinitionStages { + /** The first stage of the Cluster definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Cluster definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Cluster 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 Cluster definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithAdministratorLoginPassword, + DefinitionStages.WithPostgresqlVersion, + DefinitionStages.WithCitusVersion, + DefinitionStages.WithMaintenanceWindow, + DefinitionStages.WithPreferredPrimaryZone, + DefinitionStages.WithEnableShardsOnCoordinator, + DefinitionStages.WithEnableHa, + DefinitionStages.WithCoordinatorServerEdition, + DefinitionStages.WithCoordinatorStorageQuotaInMb, + DefinitionStages.WithCoordinatorVCores, + DefinitionStages.WithCoordinatorEnablePublicIpAccess, + DefinitionStages.WithNodeServerEdition, + DefinitionStages.WithNodeCount, + DefinitionStages.WithNodeStorageQuotaInMb, + DefinitionStages.WithNodeVCores, + DefinitionStages.WithNodeEnablePublicIpAccess, + DefinitionStages.WithSourceResourceId, + DefinitionStages.WithSourceLocation, + DefinitionStages.WithPointInTimeUtc { + /** + * Executes the create request. + * + * @return the created resource. + */ + Cluster create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Cluster create(Context context); + } + /** The stage of the Cluster 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 Cluster 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 Cluster definition allowing to specify postgresqlVersion. */ + interface WithPostgresqlVersion { + /** + * Specifies the postgresqlVersion property: The major PostgreSQL version on all cluster servers.. + * + * @param postgresqlVersion The major PostgreSQL version on all cluster servers. + * @return the next definition stage. + */ + WithCreate withPostgresqlVersion(String postgresqlVersion); + } + /** The stage of the Cluster definition allowing to specify citusVersion. */ + interface WithCitusVersion { + /** + * Specifies the citusVersion property: The Citus extension version on all cluster servers.. + * + * @param citusVersion The Citus extension version on all cluster servers. + * @return the next definition stage. + */ + WithCreate withCitusVersion(String citusVersion); + } + /** The stage of the Cluster 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 Cluster definition allowing to specify preferredPrimaryZone. */ + interface WithPreferredPrimaryZone { + /** + * Specifies the preferredPrimaryZone property: Preferred primary availability zone (AZ) for all cluster + * servers.. + * + * @param preferredPrimaryZone Preferred primary availability zone (AZ) for all cluster servers. + * @return the next definition stage. + */ + WithCreate withPreferredPrimaryZone(String preferredPrimaryZone); + } + /** The stage of the Cluster 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 Cluster definition allowing to specify enableHa. */ + interface WithEnableHa { + /** + * Specifies the enableHa property: If high availability (HA) is enabled or not for the cluster.. + * + * @param enableHa If high availability (HA) is enabled or not for the cluster. + * @return the next definition stage. + */ + WithCreate withEnableHa(Boolean enableHa); + } + /** The stage of the Cluster definition allowing to specify coordinatorServerEdition. */ + interface WithCoordinatorServerEdition { + /** + * Specifies the coordinatorServerEdition property: The edition of a coordinator server (default: + * GeneralPurpose). Required for creation.. + * + * @param coordinatorServerEdition The edition of a coordinator server (default: GeneralPurpose). Required + * for creation. + * @return the next definition stage. + */ + WithCreate withCoordinatorServerEdition(String coordinatorServerEdition); + } + /** The stage of the Cluster definition allowing to specify coordinatorStorageQuotaInMb. */ + interface WithCoordinatorStorageQuotaInMb { + /** + * Specifies the coordinatorStorageQuotaInMb property: The storage of a server in MB. Required for creation. + * See https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information.. + * + * @param coordinatorStorageQuotaInMb The storage of a server in MB. Required for creation. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * @return the next definition stage. + */ + WithCreate withCoordinatorStorageQuotaInMb(Integer coordinatorStorageQuotaInMb); + } + /** The stage of the Cluster definition allowing to specify coordinatorVCores. */ + interface WithCoordinatorVCores { + /** + * Specifies the coordinatorVCores property: The vCores count of a server (max: 96). Required for creation. + * See https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information.. + * + * @param coordinatorVCores The vCores count of a server (max: 96). Required for creation. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * @return the next definition stage. + */ + WithCreate withCoordinatorVCores(Integer coordinatorVCores); + } + /** The stage of the Cluster definition allowing to specify coordinatorEnablePublicIpAccess. */ + interface WithCoordinatorEnablePublicIpAccess { + /** + * Specifies the coordinatorEnablePublicIpAccess property: If public access is enabled on coordinator.. + * + * @param coordinatorEnablePublicIpAccess If public access is enabled on coordinator. + * @return the next definition stage. + */ + WithCreate withCoordinatorEnablePublicIpAccess(Boolean coordinatorEnablePublicIpAccess); + } + /** The stage of the Cluster definition allowing to specify nodeServerEdition. */ + interface WithNodeServerEdition { + /** + * Specifies the nodeServerEdition property: The edition of a node server (default: MemoryOptimized).. + * + * @param nodeServerEdition The edition of a node server (default: MemoryOptimized). + * @return the next definition stage. + */ + WithCreate withNodeServerEdition(String nodeServerEdition); + } + /** The stage of the Cluster 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 + * single node configuration with the ability to create distributed tables on that node. 2 or more worker + * nodes represent multi-node configuration. Node count value cannot be 1. Required for creation.. + * + * @param nodeCount Worker node count of the cluster. When node count is 0, it represents a single node + * configuration with the ability to create distributed tables on that node. 2 or more worker nodes + * represent multi-node configuration. Node count value cannot be 1. Required for creation. + * @return the next definition stage. + */ + WithCreate withNodeCount(Integer nodeCount); + } + /** The stage of the Cluster definition allowing to specify nodeStorageQuotaInMb. */ + interface WithNodeStorageQuotaInMb { + /** + * Specifies the nodeStorageQuotaInMb property: The storage in MB on each worker node. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information.. + * + * @param nodeStorageQuotaInMb The storage in MB on each worker node. See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * @return the next definition stage. + */ + WithCreate withNodeStorageQuotaInMb(Integer nodeStorageQuotaInMb); + } + /** The stage of the Cluster definition allowing to specify nodeVCores. */ + interface WithNodeVCores { + /** + * Specifies the nodeVCores property: The compute in vCores on each worker node (max: 104). See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information.. + * + * @param nodeVCores The compute in vCores on each worker node (max: 104). See + * https://learn.microsoft.com/azure/cosmos-db/postgresql/resources-compute for more information. + * @return the next definition stage. + */ + WithCreate withNodeVCores(Integer nodeVCores); + } + /** The stage of the Cluster definition allowing to specify nodeEnablePublicIpAccess. */ + interface WithNodeEnablePublicIpAccess { + /** + * Specifies the nodeEnablePublicIpAccess property: If public access is enabled on worker nodes.. + * + * @param nodeEnablePublicIpAccess If public access is enabled on worker nodes. + * @return the next definition stage. + */ + WithCreate withNodeEnablePublicIpAccess(Boolean nodeEnablePublicIpAccess); + } + /** The stage of the Cluster definition allowing to specify sourceResourceId. */ + interface WithSourceResourceId { + /** + * Specifies the sourceResourceId property: The resource id of source cluster for read replica clusters.. + * + * @param sourceResourceId The resource id of source cluster for read replica clusters. + * @return the next definition stage. + */ + WithCreate withSourceResourceId(String sourceResourceId); + } + /** The stage of the Cluster definition allowing to specify sourceLocation. */ + interface WithSourceLocation { + /** + * Specifies the sourceLocation property: The Azure region of source cluster for read replica clusters.. + * + * @param sourceLocation The Azure region of source cluster for read replica clusters. + * @return the next definition stage. + */ + WithCreate withSourceLocation(String sourceLocation); + } + /** The stage of the Cluster definition allowing to specify pointInTimeUtc. */ + interface WithPointInTimeUtc { + /** + * Specifies the pointInTimeUtc property: Date and time in UTC (ISO8601 format) for cluster restore.. + * + * @param pointInTimeUtc Date and time in UTC (ISO8601 format) for cluster restore. + * @return the next definition stage. + */ + WithCreate withPointInTimeUtc(OffsetDateTime pointInTimeUtc); + } + } + /** + * Begins update for the Cluster resource. + * + * @return the stage of resource update. + */ + Cluster.Update update(); + + /** The template for Cluster 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. + */ + Cluster apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Cluster apply(Context context); + } + /** The Cluster update stages. */ + interface UpdateStages { + /** The stage of the Cluster 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 Cluster update allowing to specify administratorLoginPassword. */ + interface WithAdministratorLoginPassword { + /** + * Specifies the administratorLoginPassword property: The password of the administrator login. Each cluster + * is created with pre-defined administrative role called ‘citus’. . + * + * @param administratorLoginPassword The password of the administrator login. Each cluster is created with + * pre-defined administrative role called ‘citus’. . + * @return the next definition stage. + */ + Update withAdministratorLoginPassword(String administratorLoginPassword); + } + /** The stage of the Cluster update allowing to specify postgresqlVersion. */ + interface WithPostgresqlVersion { + /** + * Specifies the postgresqlVersion property: The major PostgreSQL version on all cluster servers.. + * + * @param postgresqlVersion The major PostgreSQL version on all cluster servers. + * @return the next definition stage. + */ + Update withPostgresqlVersion(String postgresqlVersion); + } + /** The stage of the Cluster update allowing to specify citusVersion. */ + interface WithCitusVersion { + /** + * Specifies the citusVersion property: The Citus extension version on all cluster servers.. + * + * @param citusVersion The Citus extension version on all cluster servers. + * @return the next definition stage. + */ + Update withCitusVersion(String citusVersion); + } + /** The stage of the Cluster 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 Cluster update allowing to specify enableHa. */ + interface WithEnableHa { + /** + * Specifies the enableHa property: If high availability (HA) is enabled or not for the cluster.. + * + * @param enableHa If high availability (HA) is enabled or not for the cluster. + * @return the next definition stage. + */ + Update withEnableHa(Boolean enableHa); + } + /** The stage of the Cluster update allowing to specify preferredPrimaryZone. */ + interface WithPreferredPrimaryZone { + /** + * Specifies the preferredPrimaryZone property: Preferred primary availability zone (AZ) for all cluster + * servers.. + * + * @param preferredPrimaryZone Preferred primary availability zone (AZ) for all cluster servers. + * @return the next definition stage. + */ + Update withPreferredPrimaryZone(String preferredPrimaryZone); + } + /** The stage of the Cluster 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 Cluster 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(Integer coordinatorStorageQuotaInMb); + } + /** The stage of the Cluster update allowing to specify coordinatorVCores. */ + interface WithCoordinatorVCores { + /** + * Specifies the coordinatorVCores property: The vCores count of the coordinator (max: 96).. + * + * @param coordinatorVCores The vCores count of the coordinator (max: 96). + * @return the next definition stage. + */ + Update withCoordinatorVCores(Integer coordinatorVCores); + } + /** The stage of the Cluster update allowing to specify coordinatorEnablePublicIpAccess. */ + interface WithCoordinatorEnablePublicIpAccess { + /** + * Specifies the coordinatorEnablePublicIpAccess property: If public access is enabled on coordinator.. + * + * @param coordinatorEnablePublicIpAccess If public access is enabled on coordinator. + * @return the next definition stage. + */ + Update withCoordinatorEnablePublicIpAccess(Boolean coordinatorEnablePublicIpAccess); + } + /** The stage of the Cluster 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 Cluster 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 + * single node configuration with the ability to create distributed tables on that node. 2 or more worker + * nodes represent multi-node configuration. Node count value cannot be 1.. + * + * @param nodeCount Worker node count of the cluster. When node count is 0, it represents a single node + * configuration with the ability to create distributed tables on that node. 2 or more worker nodes + * represent multi-node configuration. Node count value cannot be 1. + * @return the next definition stage. + */ + Update withNodeCount(Integer nodeCount); + } + /** The stage of the Cluster update allowing to specify nodeStorageQuotaInMb. */ + interface WithNodeStorageQuotaInMb { + /** + * Specifies the nodeStorageQuotaInMb property: The storage in MB on each worker node.. + * + * @param nodeStorageQuotaInMb The storage in MB on each worker node. + * @return the next definition stage. + */ + Update withNodeStorageQuotaInMb(Integer nodeStorageQuotaInMb); + } + /** The stage of the Cluster update allowing to specify nodeVCores. */ + interface WithNodeVCores { + /** + * Specifies the nodeVCores property: The compute in vCores on each worker node (max: 104).. + * + * @param nodeVCores The compute in vCores on each worker node (max: 104). + * @return the next definition stage. + */ + Update withNodeVCores(Integer nodeVCores); + } + /** The stage of the Cluster 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. + */ + Cluster refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Cluster refresh(Context context); + + /** + * Restarts all nodes in 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 all nodes in 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 stopped compute on all cluster nodes. + * + * @throws com.azure.core.management.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 stopped compute on all cluster nodes. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 compute on all cluster nodes. + * + * @throws com.azure.core.management.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 compute on all cluster nodes. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * Promotes read replica cluster to an independent read-write 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(); + + /** + * Promotes read replica cluster to an independent read-write 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/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..d3ee08911cfcc --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterForUpdate.java @@ -0,0 +1,432 @@ +// 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. Each cluster is created + * with pre-defined administrative role called ‘citus’. . + * + * @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. Each cluster is created + * with pre-defined administrative role called ‘citus’. . + * + * @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 major PostgreSQL version on all cluster servers. + * + * @return the postgresqlVersion value. + */ + public String postgresqlVersion() { + return this.innerProperties() == null ? null : this.innerProperties().postgresqlVersion(); + } + + /** + * Set the postgresqlVersion property: The major PostgreSQL version on all cluster servers. + * + * @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 extension version on all cluster servers. + * + * @return the citusVersion value. + */ + public String citusVersion() { + return this.innerProperties() == null ? null : this.innerProperties().citusVersion(); + } + + /** + * Set the citusVersion property: The Citus extension version on all cluster servers. + * + * @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 (HA) 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 (HA) 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 availability zone (AZ) for all cluster servers. + * + * @return the preferredPrimaryZone value. + */ + public String preferredPrimaryZone() { + return this.innerProperties() == null ? null : this.innerProperties().preferredPrimaryZone(); + } + + /** + * Set the preferredPrimaryZone property: Preferred primary availability zone (AZ) for all cluster servers. + * + * @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 Integer 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(Integer 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: 96). + * + * @return the coordinatorVCores value. + */ + public Integer coordinatorVCores() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorVCores(); + } + + /** + * Set the coordinatorVCores property: The vCores count of the coordinator (max: 96). + * + * @param coordinatorVCores the coordinatorVCores value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withCoordinatorVCores(Integer coordinatorVCores) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withCoordinatorVCores(coordinatorVCores); + return this; + } + + /** + * Get the coordinatorEnablePublicIpAccess property: If public access is enabled on coordinator. + * + * @return the coordinatorEnablePublicIpAccess value. + */ + public Boolean coordinatorEnablePublicIpAccess() { + return this.innerProperties() == null ? null : this.innerProperties().coordinatorEnablePublicIpAccess(); + } + + /** + * Set the coordinatorEnablePublicIpAccess property: If public access is enabled on 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 single node + * configuration with the ability to create distributed tables on that node. 2 or more worker nodes represent + * multi-node configuration. Node count value cannot be 1. + * + * @return the nodeCount value. + */ + public Integer 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 single node + * configuration with the ability to create distributed tables on that node. 2 or more worker nodes represent + * multi-node configuration. Node count value cannot be 1. + * + * @param nodeCount the nodeCount value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withNodeCount(Integer nodeCount) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withNodeCount(nodeCount); + return this; + } + + /** + * Get the nodeStorageQuotaInMb property: The storage in MB on each worker node. + * + * @return the nodeStorageQuotaInMb value. + */ + public Integer nodeStorageQuotaInMb() { + return this.innerProperties() == null ? null : this.innerProperties().nodeStorageQuotaInMb(); + } + + /** + * Set the nodeStorageQuotaInMb property: The storage in MB on each worker node. + * + * @param nodeStorageQuotaInMb the nodeStorageQuotaInMb value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withNodeStorageQuotaInMb(Integer nodeStorageQuotaInMb) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withNodeStorageQuotaInMb(nodeStorageQuotaInMb); + return this; + } + + /** + * Get the nodeVCores property: The compute in vCores on each worker node (max: 104). + * + * @return the nodeVCores value. + */ + public Integer nodeVCores() { + return this.innerProperties() == null ? null : this.innerProperties().nodeVCores(); + } + + /** + * Set the nodeVCores property: The compute in vCores on each worker node (max: 104). + * + * @param nodeVCores the nodeVCores value to set. + * @return the ClusterForUpdate object itself. + */ + public ClusterForUpdate withNodeVCores(Integer nodeVCores) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterPropertiesForUpdate(); + } + this.innerProperties().withNodeVCores(nodeVCores); + return this; + } + + /** + * Get the nodeEnablePublicIpAccess property: If public access is enabled on worker nodes. + * + * @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..0099c6d6e5a64 --- /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.ClusterInner; +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/ClusterServer.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterServer.java new file mode 100644 index 0000000000000..118aa833a4d2a --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ClusterServer.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.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 major PostgreSQL version of server. + * + * @return the postgresqlVersion value. + */ + String postgresqlVersion(); + + /** + * Gets the citusVersion property: The Citus extension 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. + */ + Integer storageQuotaInMb(); + + /** + * Gets the vCores property: The vCores count of a server. + * + * @return the vCores value. + */ + Integer vCores(); + + /** + * Gets the enableHa property: If high availability (HA) is enabled or not for the server. + * + * @return the enableHa value. + */ + Boolean enableHa(); + + /** + * Gets the enablePublicIpAccess property: If public access is enabled on server. + * + * @return the enablePublicIpAccess value. + */ + Boolean enablePublicIpAccess(); + + /** + * Gets the isReadOnly property: If server database is set to read-only by system maintenance depending on high disk + * space usage. + * + * @return the isReadOnly value. + */ + Boolean isReadOnly(); + + /** + * Gets the administratorLogin property: The administrator's login name of the servers in the cluster. + * + * @return the administratorLogin value. + */ + String administratorLogin(); + + /** + * 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..ff078de073f22 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Clusters.java @@ -0,0 +1,283 @@ +// 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 { + /** + * Lists all clusters in a 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(); + + /** + * Lists all clusters in a 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); + + /** + * Lists all clusters in a 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); + + /** + * Lists all clusters in a 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 such as compute and storage configuration and cluster lifecycle metadata such as + * cluster creation date and time. + * + * @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 such as compute and storage configuration and cluster lifecycle metadata such + * as cluster creation date and time along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String clusterName, Context context); + + /** + * Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as + * cluster creation date and time. + * + * @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 such as compute and storage configuration and cluster lifecycle metadata such + * as cluster creation date and time. + */ + Cluster 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 all nodes in 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 all nodes in 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 stopped compute on all cluster nodes. + * + * @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 stopped compute on all cluster nodes. + * + * @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 compute on all cluster nodes. + * + * @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 compute on all cluster nodes. + * + * @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); + + /** + * Promotes read replica cluster to an independent read-write 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); + + /** + * Promotes read replica cluster to an independent read-write 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); + + /** + * Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most + * 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end + * with a hyphen. + * + * @param nameAvailabilityRequest The required parameters for checking if cluster 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 cluster name availability along with {@link Response}. + */ + Response checkNameAvailabilityWithResponse( + NameAvailabilityRequest nameAvailabilityRequest, Context context); + + /** + * Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most + * 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end + * with a hyphen. + * + * @param nameAvailabilityRequest The required parameters for checking if cluster 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 cluster name availability. + */ + NameAvailability checkNameAvailability(NameAvailabilityRequest nameAvailabilityRequest); + + /** + * Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as + * cluster creation date and time. + * + * @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 such as compute and storage configuration and cluster lifecycle metadata such + * as cluster creation date and time along with {@link Response}. + */ + Cluster getById(String id); + + /** + * Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as + * cluster creation date and time. + * + * @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 such as compute and storage configuration and cluster lifecycle metadata such + * as cluster creation date and time 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 Cluster resource. + * + * @param name resource name. + * @return the first stage of the new Cluster definition. + */ + Cluster.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..501b84f4dcc42 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Configuration.java @@ -0,0 +1,89 @@ +// 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 provisioningState property: Provisioning state of the configuration. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * 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..dc62dbdb494ac --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ConfigurationDataType.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 a new instance of ConfigurationDataType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ConfigurationDataType() { + } + + /** + * Creates or finds a ConfigurationDataType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConfigurationDataType. + */ + @JsonCreator + public static ConfigurationDataType fromString(String name) { + return fromString(name, ConfigurationDataType.class); + } + + /** + * Gets known ConfigurationDataType values. + * + * @return known ConfigurationDataType values. + */ + public static Collection values() { + return values(ConfigurationDataType.class); + } +} diff --git a/sdk/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..1c1ad6c33b21a --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Configurations.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationInner; + +/** 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); + + /** + * Gets information of a configuration for coordinator. + * + * @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 along with {@link Response}. + */ + Response getCoordinatorWithResponse( + String resourceGroupName, String clusterName, String configurationName, Context context); + + /** + * Gets information of a configuration for coordinator. + * + * @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. + */ + ServerConfiguration getCoordinator(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 updateOnCoordinator( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner 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 updateOnCoordinator( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner parameters, + Context context); + + /** + * Gets information of a configuration for worker 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 worker nodes along with {@link Response}. + */ + Response getNodeWithResponse( + String resourceGroupName, String clusterName, String configurationName, Context context); + + /** + * Gets information of a configuration for worker 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 worker nodes. + */ + ServerConfiguration getNode(String resourceGroupName, String clusterName, String configurationName); + + /** + * Updates configuration of worker 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 updateOnNode( + String resourceGroupName, String clusterName, String configurationName, ServerConfigurationInner parameters); + + /** + * Updates configuration of worker 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 updateOnNode( + String resourceGroupName, + String clusterName, + String configurationName, + ServerConfigurationInner 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..f13d0a22ca07f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/FirewallRule.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.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 provisioningState property: Provisioning state of the firewall rule. + * + * @return the provisioningState value. + */ + ProvisioningState 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.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..7a53f3d00f7b4 --- /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); + + /** + * Lists all the firewall rules on 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); + + /** + * Lists all the firewall rules on 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..605f5501f4e94 --- /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; + +/** Schedule settings for regular cluster updates. */ +@Fluent +public final class MaintenanceWindow { + /* + * Indicates whether custom maintenance window is enabled or not. + */ + @JsonProperty(value = "customWindow") + private String customWindow; + + /* + * Start hour within preferred day of the week for maintenance window. + */ + @JsonProperty(value = "startHour") + private Integer startHour; + + /* + * Start minute within the start hour for maintenance window. + */ + @JsonProperty(value = "startMinute") + private Integer startMinute; + + /* + * Preferred day of the 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 maintenance window is enabled or not. + * + * @return the customWindow value. + */ + public String customWindow() { + return this.customWindow; + } + + /** + * Set the customWindow property: Indicates whether custom maintenance window is enabled or not. + * + * @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 within preferred day of the week for maintenance window. + * + * @return the startHour value. + */ + public Integer startHour() { + return this.startHour; + } + + /** + * Set the startHour property: Start hour within preferred day of the week 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 within the start hour for maintenance window. + * + * @return the startMinute value. + */ + public Integer startMinute() { + return this.startMinute; + } + + /** + * Set the startMinute property: Start minute within the start hour 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: Preferred day of the week for maintenance window. + * + * @return the dayOfWeek value. + */ + public Integer dayOfWeek() { + return this.dayOfWeek; + } + + /** + * Set the dayOfWeek property: Preferred day of the 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..30135fcadbc01 --- /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 cluster 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..b22d5a57d0602 --- /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 cluster name availability. */ +@Fluent +public final class NameAvailabilityRequest { + /* + * Cluster 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: Cluster name to verify. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Cluster 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..ad6e15e342213 --- /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..428054d173b21 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/OperationOrigin.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 a new instance of OperationOrigin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OperationOrigin() { + } + + /** + * Creates or finds a OperationOrigin from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationOrigin. + */ + @JsonCreator + public static OperationOrigin fromString(String name) { + return fromString(name, OperationOrigin.class); + } + + /** + * Gets known OperationOrigin values. + * + * @return known OperationOrigin values. + */ + public static Collection values() { + return values(OperationOrigin.class); + } +} diff --git a/sdk/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/PrivateEndpoint.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpoint.java new file mode 100644 index 0000000000000..0fe8bdbe716ae --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpoint.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The private endpoint resource. */ +@Immutable +public final class PrivateEndpoint { + /* + * The ARM identifier for private endpoint. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** Creates an instance of PrivateEndpoint class. */ + public PrivateEndpoint() { + } + + /** + * Get the id property: The ARM identifier for private endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * 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/PrivateEndpointConnection.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..eccb6d4a7ef97 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnection.java @@ -0,0 +1,216 @@ +// 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.PrivateEndpointConnectionInner; +import java.util.List; + +/** An immutable client-side representation of PrivateEndpointConnection. */ +public interface PrivateEndpointConnection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the groupIds property: The group ids for the private endpoint resource. + * + * @return the groupIds value. + */ + List groupIds(); + + /** + * Gets the privateEndpoint property: The private endpoint resource. + * + * @return the privateEndpoint value. + */ + PrivateEndpoint privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: A collection of information about the state of the + * connection between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionState privateLinkServiceConnectionState(); + + /** + * Gets the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + PrivateEndpointConnectionProvisioningState 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.PrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); + + /** The entirety of the PrivateEndpointConnection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The PrivateEndpointConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the PrivateEndpointConnection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PrivateEndpointConnection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, 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 PrivateEndpointConnection definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithPrivateEndpoint, DefinitionStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnection create(Context context); + } + /** The stage of the PrivateEndpointConnection definition allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: The private endpoint resource.. + * + * @param privateEndpoint The private endpoint resource. + * @return the next definition stage. + */ + WithCreate withPrivateEndpoint(PrivateEndpoint privateEndpoint); + } + /** + * The stage of the PrivateEndpointConnection definition allowing to specify privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: A collection of information about the state of + * the connection between service consumer and provider.. + * + * @param privateLinkServiceConnectionState A collection of information about the state of the connection + * between service consumer and provider. + * @return the next definition stage. + */ + WithCreate withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState); + } + } + /** + * Begins update for the PrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + PrivateEndpointConnection.Update update(); + + /** The template for PrivateEndpointConnection update. */ + interface Update extends UpdateStages.WithPrivateEndpoint, UpdateStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PrivateEndpointConnection apply(Context context); + } + /** The PrivateEndpointConnection update stages. */ + interface UpdateStages { + /** The stage of the PrivateEndpointConnection update allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: The private endpoint resource.. + * + * @param privateEndpoint The private endpoint resource. + * @return the next definition stage. + */ + Update withPrivateEndpoint(PrivateEndpoint privateEndpoint); + } + /** The stage of the PrivateEndpointConnection update allowing to specify privateLinkServiceConnectionState. */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: A collection of information about the state of + * the connection between service consumer and provider.. + * + * @param privateLinkServiceConnectionState A collection of information about the state of the connection + * between service consumer and provider. + * @return the next definition stage. + */ + Update withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/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..20ff84a54b7fd --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlhsc.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of private endpoint connections associated with the specified resource. */ +@Fluent +public final class PrivateEndpointConnectionListResult { + /* + * Array of private endpoint connections. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of PrivateEndpointConnectionListResult class. */ + public PrivateEndpointConnectionListResult() { + } + + /** + * Get the value property: Array of private endpoint connections. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array 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; + } + + /** + * 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/PrivateEndpointConnectionProvisioningState.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnectionProvisioningState.java new file mode 100644 index 0000000000000..61a5cd92b7d41 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnectionProvisioningState.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The current provisioning state. */ +public final class PrivateEndpointConnectionProvisioningState + extends ExpandableStringEnum { + /** Static value Succeeded for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Creating for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState CREATING = fromString("Creating"); + + /** Static value Deleting for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState DELETING = fromString("Deleting"); + + /** Static value Failed for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState FAILED = fromString("Failed"); + + /** + * Creates a new instance of PrivateEndpointConnectionProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateEndpointConnectionProvisioningState() { + } + + /** + * Creates or finds a PrivateEndpointConnectionProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointConnectionProvisioningState. + */ + @JsonCreator + public static PrivateEndpointConnectionProvisioningState fromString(String name) { + return fromString(name, PrivateEndpointConnectionProvisioningState.class); + } + + /** + * Gets known PrivateEndpointConnectionProvisioningState values. + * + * @return known PrivateEndpointConnectionProvisioningState values. + */ + public static Collection values() { + return values(PrivateEndpointConnectionProvisioningState.class); + } +} 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..771ba0001a267 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointConnections.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.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 associated with 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 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 associated with 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 private endpoint connection. + */ + PrivateEndpointConnection 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 associated with 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 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 associated with 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, 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}. + */ + PrivateEndpointConnection 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 PrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnection definition. + */ + PrivateEndpointConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/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/PrivateEndpointServiceConnectionStatus.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointServiceConnectionStatus.java new file mode 100644 index 0000000000000..035669087ab26 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateEndpointServiceConnectionStatus.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The private endpoint connection status. */ +public final class PrivateEndpointServiceConnectionStatus + extends ExpandableStringEnum { + /** Static value Pending for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus PENDING = fromString("Pending"); + + /** Static value Approved for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus APPROVED = fromString("Approved"); + + /** Static value Rejected for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus REJECTED = fromString("Rejected"); + + /** + * Creates a new instance of PrivateEndpointServiceConnectionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateEndpointServiceConnectionStatus() { + } + + /** + * Creates or finds a PrivateEndpointServiceConnectionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointServiceConnectionStatus. + */ + @JsonCreator + public static PrivateEndpointServiceConnectionStatus fromString(String name) { + return fromString(name, PrivateEndpointServiceConnectionStatus.class); + } + + /** + * Gets known PrivateEndpointServiceConnectionStatus values. + * + * @return known PrivateEndpointServiceConnectionStatus values. + */ + public static Collection values() { + return values(PrivateEndpointServiceConnectionStatus.class); + } +} 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..74e3f8e73d673 --- /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 private link DNS zone name. + * + * @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..2c2623f70a7e0 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateLinkResourceListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 { + /* + * Array of private link resources + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of PrivateLinkResourceListResult class. */ + public PrivateLinkResourceListResult() { + } + + /** + * Get the value property: Array of private link resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array 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; + } + + /** + * 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..44ef633a2a08f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/PrivateLinkServiceConnectionState.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A collection of information about the state of the connection between service consumer and provider. */ +@Fluent +public final class PrivateLinkServiceConnectionState { + /* + * Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + */ + @JsonProperty(value = "status") + private PrivateEndpointServiceConnectionStatus status; + + /* + * The reason for approval/rejection of the connection. + */ + @JsonProperty(value = "description") + private String description; + + /* + * A message indicating if changes on the service provider require any updates on the consumer. + */ + @JsonProperty(value = "actionsRequired") + private String actionsRequired; + + /** Creates an instance of PrivateLinkServiceConnectionState class. */ + public PrivateLinkServiceConnectionState() { + } + + /** + * Get the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @return the status value. + */ + public PrivateEndpointServiceConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withStatus(PrivateEndpointServiceConnectionStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The reason for approval/rejection of the connection. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The reason for approval/rejection of the connection. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Set the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @param actionsRequired the actionsRequired value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withActionsRequired(String actionsRequired) { + this.actionsRequired = actionsRequired; + 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/ProvisioningState.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ProvisioningState.java new file mode 100644 index 0000000000000..f4903c0caaea0 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ProvisioningState.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.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The current provisioning state. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value InProgress for ProvisioningState. */ + public static final ProvisioningState IN_PROGRESS = fromString("InProgress"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Role.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Role.java new file mode 100644 index 0000000000000..0b2aa8933325a --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Role.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.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 provisioningState property: Provisioning state of the role. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * 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.WithPassword, + 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. + */ + WithPassword withExistingServerGroupsv2(String resourceGroupName, String clusterName); + } + /** 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); + } + /** + * 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 { + /** + * 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); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Role refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Role refresh(Context context); +} 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..673f75f6063f2 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/Roles.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 Roles. */ +public interface Roles { + /** + * Gets information about 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 information about a cluster role along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String clusterName, String roleName, Context context); + + /** + * Gets information about 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 information about a cluster role. + */ + Role get(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * Gets information about 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. + * @return information about a cluster role along with {@link Response}. + */ + Role getById(String id); + + /** + * Gets information about 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. + * @return information about a cluster role along with {@link Response}. + */ + Response getByIdWithResponse(String id, 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..d1eb0fa112ce5 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerConfiguration.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.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 provisioningState property: Provisioning state of the configuration. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * 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/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..b07f1b20e8cb4 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerProperties.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 Integer storageQuotaInMb; + + /* + * The vCores count of a server. + */ + @JsonProperty(value = "vCores") + private Integer vCores; + + /* + * If high availability (HA) is enabled or not for the server. + */ + @JsonProperty(value = "enableHa") + private Boolean enableHa; + + /* + * If public access is enabled on server. + */ + @JsonProperty(value = "enablePublicIpAccess", access = JsonProperty.Access.WRITE_ONLY) + private Boolean enablePublicIpAccess; + + /* + * If server database is set to read-only by system maintenance depending on high disk space usage. + */ + @JsonProperty(value = "isReadOnly", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isReadOnly; + + /* + * The administrator's login name of the servers in the cluster. + */ + @JsonProperty(value = "administratorLogin", access = JsonProperty.Access.WRITE_ONLY) + private String administratorLogin; + + /** 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 Integer 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(Integer storageQuotaInMb) { + this.storageQuotaInMb = storageQuotaInMb; + return this; + } + + /** + * Get the vCores property: The vCores count of a server. + * + * @return the vCores value. + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the vCores property: The vCores count of a server. + * + * @param vCores the vCores value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the enableHa property: If high availability (HA) is enabled or not for the server. + * + * @return the enableHa value. + */ + public Boolean enableHa() { + return this.enableHa; + } + + /** + * Set the enableHa property: If high availability (HA) 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 enablePublicIpAccess property: If public access is enabled on server. + * + * @return the enablePublicIpAccess value. + */ + public Boolean enablePublicIpAccess() { + return this.enablePublicIpAccess; + } + + /** + * Get the isReadOnly property: If server database is set to read-only by system maintenance depending on high disk + * space usage. + * + * @return the isReadOnly value. + */ + public Boolean isReadOnly() { + return this.isReadOnly; + } + + /** + * 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; + } + + /** + * 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..f753f0c1e4ef1 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/ServerRole.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 a new instance of ServerRole value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ServerRole() { + } + + /** + * 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/SimplePrivateEndpointConnection.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/SimplePrivateEndpointConnection.java new file mode 100644 index 0000000000000..0fd2454d92d2e --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/SimplePrivateEndpointConnection.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 SimplePrivateEndpointConnection 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 SimplePrivateEndpointConnection class. */ + public SimplePrivateEndpointConnection() { + } + + /** + * 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 SimplePrivateEndpointConnection object itself. + */ + public SimplePrivateEndpointConnection 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 SimplePrivateEndpointConnection object itself. + */ + public SimplePrivateEndpointConnection withGroupIds(List groupIds) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionSimpleProperties(); + } + this.innerProperties().withGroupIds(groupIds); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the SimplePrivateEndpointConnection object itself. + */ + public SimplePrivateEndpointConnection withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState 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/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..456455ce81e65 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/models/package-info.java @@ -0,0 +1,9 @@ +// 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. Azure Cosmos DB for PostgreSQL database service + * resource provider REST APIs. + */ +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..87c64d7cb204a --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/main/java/com/azure/resourcemanager/postgresqlhsc/package-info.java @@ -0,0 +1,9 @@ +// 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. Azure Cosmos DB for PostgreSQL database service resource + * provider REST APIs. + */ +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..d88ea51023e57 --- /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.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"), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersCreateSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersCreateSamples.java new file mode 100644 index 0000000000000..ddffd911d984f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersCreateSamples.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Clusters Create. */ +public final class ClustersCreateSamples { + /* + * 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("testcluster") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/sourcecluster") + .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("testcluster") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/source-cluster") + .withSourceLocation("westus") + .withPointInTimeUtc(OffsetDateTime.parse("2017-12-14T00:00:37.467Z")) + .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("testcluster") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withTags(mapOf()) + .withAdministratorLoginPassword("password") + .withPostgresqlVersion("15") + .withCitusVersion("11.1") + .withPreferredPrimaryZone("1") + .withEnableShardsOnCoordinator(false) + .withEnableHa(true) + .withCoordinatorServerEdition("GeneralPurpose") + .withCoordinatorStorageQuotaInMb(524288) + .withCoordinatorVCores(4) + .withCoordinatorEnablePublicIpAccess(true) + .withNodeServerEdition("MemoryOptimized") + .withNodeCount(3) + .withNodeStorageQuotaInMb(524288) + .withNodeVCores(8) + .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..b2a5fe5d291d3 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersDeleteSamples.java @@ -0,0 +1,20 @@ +// 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 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", com.azure.core.util.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..6237ca8bd8139 --- /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; + +/** 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", "testcluster1", com.azure.core.util.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..8d4e8a006b9e8 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// 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 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", com.azure.core.util.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..e0de8c4e1da80 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersListSamples.java @@ -0,0 +1,20 @@ +// 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 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(com.azure.core.util.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..be6512d599b71 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersPromoteReadReplicaSamples.java @@ -0,0 +1,21 @@ +// 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 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 read replica cluster to an independent read-write cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void promoteReadReplicaClusterToAnIndependentReadWriteCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.clusters().promoteReadReplica("TestGroup", "testcluster1", com.azure.core.util.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..2bfdd441b2d55 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersRestartSamples.java @@ -0,0 +1,21 @@ +// 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 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", "testcluster1", com.azure.core.util.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..d8e6b6a839d0a --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersStartSamples.java @@ -0,0 +1,21 @@ +// 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 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", "testcluster1", com.azure.core.util.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..6c3250e091ed4 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersStopSamples.java @@ -0,0 +1,21 @@ +// 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 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", "testcluster1", com.azure.core.util.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..e3460377bc74b --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ClustersUpdateSamples.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.generated; + +import com.azure.resourcemanager.postgresqlhsc.models.Cluster; +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 up storage. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void scaleUpStorage(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + Cluster resource = + manager + .clusters() + .getByResourceGroupWithResponse("TestGroup", "testcluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withNodeStorageQuotaInMb(2097152).apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterUpdate.json + */ + /** + * Sample code: Update multiple configuration settings of the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateMultipleConfigurationSettingsOfTheCluster( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + Cluster resource = + manager + .clusters() + .getByResourceGroupWithResponse("TestGroup", "testcluster", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withAdministratorLoginPassword("newpassword") + .withCoordinatorVCores(16) + .withNodeCount(4) + .withNodeVCores(16) + .apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterScaleCompute.json + */ + /** + * Sample code: Scale compute up or down. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void scaleComputeUpOrDown(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + Cluster resource = + manager + .clusters() + .getByResourceGroupWithResponse("TestGroup", "testcluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withNodeVCores(16).apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterAddNode.json + */ + /** + * Sample code: Scale out: Add new worker nodes. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void scaleOutAddNewWorkerNodes(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + Cluster resource = + manager + .clusters() + .getByResourceGroupWithResponse("TestGroup", "testcluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withNodeCount(2).apply(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterUpdateMaintenanceWindow.json + */ + /** + * Sample code: Update or define maintenance window. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void updateOrDefineMaintenanceWindow( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + Cluster resource = + manager + .clusters() + .getByResourceGroupWithResponse("TestGroup", "testcluster", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withMaintenanceWindow( + new MaintenanceWindow() + .withCustomWindow("Enabled") + .withStartHour(8) + .withStartMinute(0) + .withDayOfWeek(0)) + .apply(); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsGetCoordinatorSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsGetCoordinatorSamples.java new file mode 100644 index 0000000000000..2efdd8123fb85 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsGetCoordinatorSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +/** Samples for Configurations GetCoordinator. */ +public final class ConfigurationsGetCoordinatorSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationGetCoordinator.json + */ + /** + * Sample code: Get configuration details for coordinator. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getConfigurationDetailsForCoordinator( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .configurations() + .getCoordinatorWithResponse( + "TestResourceGroup", "testcluster", "array_nulls", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsGetNodeSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsGetNodeSamples.java new file mode 100644 index 0000000000000..522f9b8ed9aa9 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsGetNodeSamples.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; + +/** Samples for Configurations GetNode. */ +public final class ConfigurationsGetNodeSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationGetNode.json + */ + /** + * Sample code: Get configuration details for node. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getConfigurationDetailsForNode( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .configurations() + .getNodeWithResponse("TestResourceGroup", "testcluster", "array_nulls", com.azure.core.util.Context.NONE); + } +} 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..ff9df0494f3b1 --- /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; + +/** 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", "testcluster", "client_encoding", com.azure.core.util.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..aa02bad00ad9c --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsListByClusterSamples.java @@ -0,0 +1,21 @@ +// 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 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", "testcluster", com.azure.core.util.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..06064630110f7 --- /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; + +/** 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", "testcluster", "testserver", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsUpdateOnCoordinatorSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsUpdateOnCoordinatorSamples.java new file mode 100644 index 0000000000000..5149ce4664fba --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsUpdateOnCoordinatorSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationInner; + +/** Samples for Configurations UpdateOnCoordinator. */ +public final class ConfigurationsUpdateOnCoordinatorSamples { + /* + * 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() + .updateOnCoordinator( + "TestResourceGroup", + "testcluster", + "array_nulls", + new ServerConfigurationInner().withValue("on"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsUpdateOnNodeSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsUpdateOnNodeSamples.java new file mode 100644 index 0000000000000..dad2fd009d894 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ConfigurationsUpdateOnNodeSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.resourcemanager.postgresqlhsc.fluent.models.ServerConfigurationInner; + +/** Samples for Configurations UpdateOnNode. */ +public final class ConfigurationsUpdateOnNodeSamples { + /* + * 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() + .updateOnNode( + "TestResourceGroup", + "testcluster", + "array_nulls", + new ServerConfigurationInner().withValue("off"), + com.azure.core.util.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..61cee439e201f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesDeleteSamples.java @@ -0,0 +1,21 @@ +// 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 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", com.azure.core.util.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..27386a1b82130 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesGetSamples.java @@ -0,0 +1,21 @@ +// 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 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", com.azure.core.util.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..a9b4a4f1c1f3d --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/FirewallRulesListByClusterSamples.java @@ -0,0 +1,21 @@ +// 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 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", com.azure.core.util.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..4569d4ded53a9 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/OperationsListSamples.java @@ -0,0 +1,21 @@ +// 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 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(com.azure.core.util.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..80b5ab88742ce --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +import com.azure.resourcemanager.postgresqlhsc.models.PrivateEndpointServiceConnectionStatus; +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: Approves or Rejects a Private Endpoint Connection with a given name. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void approvesOrRejectsAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager + .privateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingServerGroupsv2("TestGroup", "testcluster") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("Approved by johndoe@contoso.com")) + .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..e755f65d244d3 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateEndpointConnectionsDeleteSamples.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; + +/** 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", "testcluster", "private-endpoint-connection-name", com.azure.core.util.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..2dfd6c35f1b99 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/PrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlhsc.generated; + +/** 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", "testcluster", "private-endpoint-connection-name", com.azure.core.util.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..faacf4ca428d6 --- /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; + +/** 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", "testcluster", com.azure.core.util.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..5deaa2a160214 --- /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; + +/** 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", "testcluster", "plr", com.azure.core.util.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..d64d301957fd0 --- /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; + +/** 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", "testcluster", com.azure.core.util.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..ec6aa0a4d5fa6 --- /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("password") + .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..f4aae3bc4741f --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/RolesDeleteSamples.java @@ -0,0 +1,20 @@ +// 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 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", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/RolesGetSamples.java b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/RolesGetSamples.java new file mode 100644 index 0000000000000..9ca74a6dd2ad9 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/RolesGetSamples.java @@ -0,0 +1,20 @@ +// 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 Get. */ +public final class RolesGetSamples { + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/RoleGet.json + */ + /** + * Sample code: Get the role of the cluster. + * + * @param manager Entry point to PostgresqlhscManager. + */ + public static void getTheRoleOfTheCluster(com.azure.resourcemanager.postgresqlhsc.PostgresqlhscManager manager) { + manager.roles().getWithResponse("TestGroup", "pgtestsvc4", "role1", com.azure.core.util.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..8dacb7d14211a --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/RolesListByClusterSamples.java @@ -0,0 +1,20 @@ +// 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 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", com.azure.core.util.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..6419716c7645e --- /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; + +/** 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", "testcluster1", "testcluster1-c", com.azure.core.util.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..58560ba3c21d6 --- /dev/null +++ b/sdk/postgresqlhsc/azure-resourcemanager-postgresqlhsc/src/samples/java/com/azure/resourcemanager/postgresqlhsc/generated/ServersListByClusterSamples.java @@ -0,0 +1,20 @@ +// 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 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", "testcluster1", com.azure.core.util.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 + +