diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/CHANGELOG.md b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/CHANGELOG.md index 77eda3362cc6..cda5079ba244 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/CHANGELOG.md +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.4 (Unreleased) +## 1.0.0-beta.1 (2024-09-30) + +- Azure Resource Manager AzureArcData client library for Java. This package contains Microsoft Azure SDK for AzureArcData Management SDK. The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. Package tag package-preview-2024-05. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/README.md b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/README.md index 1814c141d6b2..4409cc4ee1b2 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/README.md +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/README.md @@ -2,7 +2,7 @@ Azure Resource Manager AzureArcData client library for Java. -This package contains Microsoft Azure SDK for AzureArcData Management SDK. The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. Package tag package-2021-08-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for AzureArcData Management SDK. The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. Package tag package-preview-2024-05. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-azurearcdata - 1.0.0-beta.3 + 1.0.0-beta.4 ``` [//]: # ({x-version-update-end}) @@ -45,15 +45,11 @@ Azure Management Libraries require a `TokenCredential` implementation for authen ### Authentication -By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables. +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. -- `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. +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. -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: +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); @@ -94,12 +90,15 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [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/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ [azure_subscription]: https://azure.microsoft.com/free/ [azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials [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/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fazurearcdata%2Fazure-resourcemanager-azurearcdata%2FREADME.png) diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/SAMPLE.md b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/SAMPLE.md index 7d1dcbc9f4fa..4fc41d956fb4 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/SAMPLE.md +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/SAMPLE.md @@ -1,6 +1,13 @@ # Code snippets and samples +## ActiveDirectoryConnectors + +- [Create](#activedirectoryconnectors_create) +- [Delete](#activedirectoryconnectors_delete) +- [Get](#activedirectoryconnectors_get) +- [List](#activedirectoryconnectors_list) + ## DataControllers - [Delete](#datacontrollers_delete) @@ -10,10 +17,26 @@ - [PatchDataController](#datacontrollers_patchdatacontroller) - [PutDataController](#datacontrollers_putdatacontroller) +## FailoverGroups + +- [Create](#failovergroups_create) +- [Delete](#failovergroups_delete) +- [Get](#failovergroups_get) +- [List](#failovergroups_list) + ## Operations - [List](#operations_list) +## PostgresInstances + +- [Create](#postgresinstances_create) +- [Delete](#postgresinstances_delete) +- [GetByResourceGroup](#postgresinstances_getbyresourcegroup) +- [List](#postgresinstances_list) +- [ListByResourceGroup](#postgresinstances_listbyresourcegroup) +- [Update](#postgresinstances_update) + ## SqlManagedInstances - [Create](#sqlmanagedinstances_create) @@ -23,25 +46,198 @@ - [ListByResourceGroup](#sqlmanagedinstances_listbyresourcegroup) - [Update](#sqlmanagedinstances_update) +## SqlServerAvailabilityGroups + +- [AddDatabases](#sqlserveravailabilitygroups_adddatabases) +- [Create](#sqlserveravailabilitygroups_create) +- [CreateAvailabilityGroup](#sqlserveravailabilitygroups_createavailabilitygroup) +- [CreateDistributedAvailabilityGroup](#sqlserveravailabilitygroups_createdistributedavailabilitygroup) +- [Delete](#sqlserveravailabilitygroups_delete) +- [DetailView](#sqlserveravailabilitygroups_detailview) +- [Failover](#sqlserveravailabilitygroups_failover) +- [ForceFailoverAllowDataLoss](#sqlserveravailabilitygroups_forcefailoverallowdataloss) +- [Get](#sqlserveravailabilitygroups_get) +- [List](#sqlserveravailabilitygroups_list) +- [RemoveDatabases](#sqlserveravailabilitygroups_removedatabases) +- [Update](#sqlserveravailabilitygroups_update) + +## SqlServerDatabases + +- [Create](#sqlserverdatabases_create) +- [Delete](#sqlserverdatabases_delete) +- [Get](#sqlserverdatabases_get) +- [List](#sqlserverdatabases_list) +- [Update](#sqlserverdatabases_update) + +## SqlServerEsuLicenses + +- [Create](#sqlserveresulicenses_create) +- [Delete](#sqlserveresulicenses_delete) +- [GetByResourceGroup](#sqlserveresulicenses_getbyresourcegroup) +- [List](#sqlserveresulicenses_list) +- [ListByResourceGroup](#sqlserveresulicenses_listbyresourcegroup) +- [Update](#sqlserveresulicenses_update) + ## SqlServerInstances - [Create](#sqlserverinstances_create) - [Delete](#sqlserverinstances_delete) - [GetByResourceGroup](#sqlserverinstances_getbyresourcegroup) +- [GetJobsStatus](#sqlserverinstances_getjobsstatus) +- [GetTelemetry](#sqlserverinstances_gettelemetry) - [List](#sqlserverinstances_list) - [ListByResourceGroup](#sqlserverinstances_listbyresourcegroup) +- [PostUpgrade](#sqlserverinstances_postupgrade) +- [PreUpgrade](#sqlserverinstances_preupgrade) +- [RunMigrationAssessment](#sqlserverinstances_runmigrationassessment) - [Update](#sqlserverinstances_update) + +## SqlServerLicenses + +- [Create](#sqlserverlicenses_create) +- [Delete](#sqlserverlicenses_delete) +- [GetByResourceGroup](#sqlserverlicenses_getbyresourcegroup) +- [List](#sqlserverlicenses_list) +- [ListByResourceGroup](#sqlserverlicenses_listbyresourcegroup) +- [Update](#sqlserverlicenses_update) +### ActiveDirectoryConnectors_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.AccountProvisioningMode; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorDnsDetails; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorDomainDetails; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorProperties; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorSpec; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainController; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainControllers; +import java.util.Arrays; + +/** + * Samples for ActiveDirectoryConnectors Create. + */ +public final class ActiveDirectoryConnectorsCreateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateActiveDirectoryConnector.json + */ + /** + * Sample code: Create or update an Active Directory connector instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createOrUpdateAnActiveDirectoryConnectorInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.activeDirectoryConnectors() + .define("testADConnector") + .withExistingDataController("testrg", "testdataController") + .withProperties(new ActiveDirectoryConnectorProperties().withSpec(new ActiveDirectoryConnectorSpec() + .withActiveDirectory(new ActiveDirectoryConnectorDomainDetails().withRealm("CONTOSO.LOCAL") + .withServiceAccountProvisioning(AccountProvisioningMode.MANUAL) + .withDomainControllers(new ActiveDirectoryDomainControllers() + .withPrimaryDomainController( + new ActiveDirectoryDomainController().withHostname("dc1.contoso.local")) + .withSecondaryDomainControllers( + Arrays.asList(new ActiveDirectoryDomainController().withHostname("dc2.contoso.local"), + new ActiveDirectoryDomainController().withHostname("dc3.contoso.local"))))) + .withDns(new ActiveDirectoryConnectorDnsDetails() + .withNameserverIpAddresses(Arrays.asList("11.11.111.111", "22.22.222.222")) + .withReplicas(1L) + .withPreferK8SDnsForPtrLookups(false)))) + .create(); + } +} +``` + +### ActiveDirectoryConnectors_Delete + +```java +/** + * Samples for ActiveDirectoryConnectors Delete. + */ +public final class ActiveDirectoryConnectorsDeleteSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteActiveDirectoryConnector.json + */ + /** + * Sample code: Deletes an Active Directory connector instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + deletesAnActiveDirectoryConnectorInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.activeDirectoryConnectors() + .delete("testrg", "testdataController", "testADConnector", com.azure.core.util.Context.NONE); + } +} +``` + +### ActiveDirectoryConnectors_Get + +```java +/** + * Samples for ActiveDirectoryConnectors Get. + */ +public final class ActiveDirectoryConnectorsGetSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetActiveDirectoryConnector.json + */ + /** + * Sample code: Retrieves an Active Directory connector resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesAnActiveDirectoryConnectorResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.activeDirectoryConnectors() + .getWithResponse("testrg", "testdataController", "testADConnector", com.azure.core.util.Context.NONE); + } +} +``` + +### ActiveDirectoryConnectors_List + +```java +/** + * Samples for ActiveDirectoryConnectors List. + */ +public final class ActiveDirectoryConnectorsListSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListByDataControllerActiveDirectoryConnector.json + */ + /** + * Sample code: Gets all Active Directory connectors associated with a data controller. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllActiveDirectoryConnectorsAssociatedWithADataController( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.activeDirectoryConnectors().list("testrg", "testdataController", com.azure.core.util.Context.NONE); + } +} +``` + ### DataControllers_Delete ```java -/** Samples for DataControllers Delete. */ +/** + * Samples for DataControllers Delete. + */ public final class DataControllersDeleteSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/DeleteDataController.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteDataController.json */ /** * Sample code: Delete a dataController. - * + * * @param manager Entry point to AzureArcDataManager. */ public static void deleteADataController(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { @@ -53,19 +249,22 @@ public final class DataControllersDeleteSamples { ### DataControllers_GetByResourceGroup ```java -/** Samples for DataControllers GetByResourceGroup. */ +/** + * Samples for DataControllers GetByResourceGroup. + */ public final class DataControllersGetByResourceGroupSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/GetDataController.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetDataController.json */ /** * Sample code: Get a data controller. - * + * * @param manager Entry point to AzureArcDataManager. */ public static void getADataController(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager - .dataControllers() + manager.dataControllers() .getByResourceGroupWithResponse("testrg", "testdataController", com.azure.core.util.Context.NONE); } } @@ -74,18 +273,22 @@ public final class DataControllersGetByResourceGroupSamples { ### DataControllers_List ```java -/** Samples for DataControllers List. */ +/** + * Samples for DataControllers List. + */ public final class DataControllersListSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ListSubscriptionDataController.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListSubscriptionDataController.json */ /** * Sample code: Gets all dataControllers in a subscription. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void getsAllDataControllersInASubscription( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + public static void + getsAllDataControllersInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { manager.dataControllers().list(com.azure.core.util.Context.NONE); } } @@ -94,18 +297,22 @@ public final class DataControllersListSamples { ### DataControllers_ListByResourceGroup ```java -/** Samples for DataControllers ListByResourceGroup. */ +/** + * Samples for DataControllers ListByResourceGroup. + */ public final class DataControllersListByResourceGroupSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ListByResourceGroupDataController.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListByResourceGroupDataController.json */ /** * Sample code: Gets all dataControllers in a resource group. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void getsAllDataControllersInAResourceGroup( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + public static void + getsAllDataControllersInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { manager.dataControllers().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); } } @@ -118,25 +325,28 @@ import com.azure.resourcemanager.azurearcdata.models.DataControllerResource; import java.util.HashMap; import java.util.Map; -/** Samples for DataControllers PatchDataController. */ +/** + * Samples for DataControllers PatchDataController. + */ public final class DataControllersPatchDataControllerSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/UpdateDataController.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * UpdateDataController.json */ /** * Sample code: Updates a dataController tags. - * + * * @param manager Entry point to AzureArcDataManager. */ public static void updatesADataControllerTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - DataControllerResource resource = - manager - .dataControllers() - .getByResourceGroupWithResponse("testrg", "testdataController1", com.azure.core.util.Context.NONE) - .getValue(); + DataControllerResource resource = manager.dataControllers() + .getByResourceGroupWithResponse("testrg", "testdataController1", com.azure.core.util.Context.NONE) + .getValue(); resource.update().withTags(mapOf("mytag", "myval")).apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -167,60 +377,112 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; -/** Samples for DataControllers PutDataController. */ +/** + * Samples for DataControllers PutDataController. + */ public final class DataControllersPutDataControllerSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/CreateOrUpdateDataController.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateDataController.json */ /** * Sample code: Create or update a Data Controller. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void createOrUpdateADataController( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager - .dataControllers() + public static void + createOrUpdateADataController(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.dataControllers() .define("testdataController") .withRegion("northeurope") .withExistingResourceGroup("testrg") - .withProperties( - new DataControllerProperties() - .withInfrastructure(Infrastructure.ONPREMISES) - .withOnPremiseProperty( - new OnPremiseProperty() - .withId(UUID.fromString("12345678-1234-1234-ab12-1a2b3c4d5e6f")) - .withPublicSigningKey("fakeTokenPlaceholder")) - .withUploadWatermark( - new UploadWatermark() - .withMetrics(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z")) - .withLogs(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z")) - .withUsages(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z"))) - .withBasicLoginInformation( - new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) - .withLogAnalyticsWorkspaceConfig( - new LogAnalyticsWorkspaceConfig() - .withWorkspaceId(UUID.fromString("00000000-1111-2222-3333-444444444444")) - .withPrimaryKey("fakeTokenPlaceholder")) - .withUploadServicePrincipal( - new UploadServicePrincipal() - .withClientId(UUID.fromString("00000000-1111-2222-3333-444444444444")) - .withTenantId(UUID.fromString("00000000-1111-2222-3333-444444444444")) - .withAuthority("https://login.microsoftonline.com/") - .withClientSecret("fakeTokenPlaceholder")) - .withClusterId( - "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s") - .withExtensionId( - "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension")) + .withProperties(new DataControllerProperties().withInfrastructure(Infrastructure.ONPREMISES) + .withOnPremiseProperty( + new OnPremiseProperty().withId(UUID.fromString("12345678-1234-1234-ab12-1a2b3c4d5e6f")) + .withPublicSigningKey("fakeTokenPlaceholder")) + .withUploadWatermark( + new UploadWatermark().withMetrics(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z")) + .withLogs(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z")) + .withUsages(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z"))) + .withBasicLoginInformation( + new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withMetricsDashboardCredential( + new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withLogsDashboardCredential( + new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withLogAnalyticsWorkspaceConfig(new LogAnalyticsWorkspaceConfig() + .withWorkspaceId(UUID.fromString("00000000-1111-2222-3333-444444444444")) + .withPrimaryKey("fakeTokenPlaceholder")) + .withUploadServicePrincipal( + new UploadServicePrincipal().withClientId(UUID.fromString("00000000-1111-2222-3333-444444444444")) + .withTenantId(UUID.fromString("00000000-1111-2222-3333-444444444444")) + .withAuthority("https://login.microsoftonline.com/") + .withClientSecret("fakeTokenPlaceholder")) + .withClusterId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s") + .withExtensionId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension")) .withTags(mapOf("mytag", "myval")) - .withExtendedLocation( - new ExtendedLocation() - .withName( - "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation") - .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### FailoverGroups_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupPartnerSyncMode; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupProperties; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupSpec; +import com.azure.resourcemanager.azurearcdata.models.InstanceFailoverGroupRole; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for FailoverGroups Create. + */ +public final class FailoverGroupsCreateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateFailoverGroup.json + */ + /** + * Sample code: Create or update a failover group instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + createOrUpdateAFailoverGroupInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.failoverGroups() + .define("testFailoverGroupName") + .withExistingSqlManagedInstance("testrg", "testSqlManagedInstance") + .withProperties(new FailoverGroupProperties().withPartnerManagedInstanceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlManagedInstances/partnerMI") + .withSpec(new FailoverGroupSpec().withPartnerSyncMode(FailoverGroupPartnerSyncMode.ASYNC) + .withRole(InstanceFailoverGroupRole.PRIMARY) + .withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf())) .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -234,17 +496,96 @@ public final class DataControllersPutDataControllerSamples { } ``` +### FailoverGroups_Delete + +```java +/** + * Samples for FailoverGroups Delete. + */ +public final class FailoverGroupsDeleteSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteFailoverGroup.json + */ + /** + * Sample code: Deletes a failover group instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + deletesAFailoverGroupInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.failoverGroups() + .delete("testrg", "testSqlManagedInstance", "testFailoverGroupName", com.azure.core.util.Context.NONE); + } +} +``` + +### FailoverGroups_Get + +```java +/** + * Samples for FailoverGroups Get. + */ +public final class FailoverGroupsGetSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetFailoverGroup.json + */ + /** + * Sample code: Retrieves a failover group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + retrievesAFailoverGroupResource(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.failoverGroups() + .getWithResponse("testrg", "testSqlManagedInstance", "testFailoverGroupName", + com.azure.core.util.Context.NONE); + } +} +``` + +### FailoverGroups_List + +```java +/** + * Samples for FailoverGroups List. + */ +public final class FailoverGroupsListSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListBySqlManagedInstanceFailoverGroup.json + */ + /** + * Sample code: Gets all failover groups associated with a sql managed instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllFailoverGroupsAssociatedWithASqlManagedInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.failoverGroups().list("testrg", "testSqlManagedInstance", com.azure.core.util.Context.NONE); + } +} +``` + ### Operations_List ```java -/** Samples for Operations List. */ +/** + * Samples for Operations List. + */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ListOperation.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListOperation.json */ /** * Sample code: Lists all of the available Azure Data Services on Azure Arc API operations. - * + * * @param manager Entry point to AzureArcDataManager. */ public static void listsAllOfTheAvailableAzureDataServicesOnAzureArcAPIOperations( @@ -254,95 +595,301 @@ public final class OperationsListSamples { } ``` +### PostgresInstances_Create + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.azurearcdata.models.BasicLoginInformation; +import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; +import com.azure.resourcemanager.azurearcdata.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceProperties; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSku; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSkuTier; +import java.io.IOException; + +/** + * Samples for PostgresInstances Create. + */ +public final class PostgresInstancesCreateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdatePostgresInstance.json + */ + /** + * Sample code: Create or update a Postgres Instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createOrUpdateAPostgresInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) throws IOException { + manager.postgresInstances() + .define("testpostgresInstance") + .withRegion("eastus") + .withExistingResourceGroup("testrg") + .withProperties(new PostgresInstanceProperties().withDataControllerId("dataControllerId") + .withAdmin("admin") + .withBasicLoginInformation( + new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withK8SRaw(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"apiVersion\":\"apiVersion\",\"kind\":\"postgresql-12\",\"metadata\":{\"name\":\"pg1\",\"creationTimestamp\":\"2020-08-25T14:55:10Z\",\"generation\":1,\"namespace\":\"test\",\"resourceVersion\":\"527780\",\"selfLink\":\"/apis/arcdata.microsoft.com/v1alpha1/namespaces/test/postgresql-12s/pg1\",\"uid\":\"1111aaaa-ffff-ffff-ffff-99999aaaaaaa\"},\"spec\":{\"backups\":{\"deltaMinutes\":3,\"fullMinutes\":10,\"tiers\":[{\"retention\":{\"maximums\":[\"6\",\"512MB\"],\"minimums\":[\"3\"]},\"storage\":{\"volumeSize\":\"1Gi\"}}]},\"engine\":{\"extensions\":[{\"name\":\"citus\"}]},\"scale\":{\"shards\":3},\"scheduling\":{\"default\":{\"resources\":{\"requests\":{\"memory\":\"256Mi\"}}}},\"service\":{\"type\":\"NodePort\"},\"storage\":{\"data\":{\"className\":\"local-storage\",\"size\":\"5Gi\"},\"logs\":{\"className\":\"local-storage\",\"size\":\"5Gi\"}}},\"status\":{\"externalEndpoint\":null,\"readyPods\":\"4/4\",\"state\":\"Ready\"}}", + Object.class, SerializerEncoding.JSON))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .withSku(new PostgresInstanceSku().withName("default") + .withDev(true) + .withTier(PostgresInstanceSkuTier.HYPERSCALE)) + .create(); + } +} +``` + +### PostgresInstances_Delete + +```java +/** + * Samples for PostgresInstances Delete. + */ +public final class PostgresInstancesDeleteSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeletePostgresInstance.json + */ + /** + * Sample code: Deletes a PostgresInstances. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deletesAPostgresInstances(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances().delete("testrg", "testpostgresInstance", com.azure.core.util.Context.NONE); + } +} +``` + +### PostgresInstances_GetByResourceGroup + +```java +/** + * Samples for PostgresInstances GetByResourceGroup. + */ +public final class PostgresInstancesGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetPostgresInstance.json + */ + /** + * Sample code: Gets a postgres Instances. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAPostgresInstances(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances() + .getByResourceGroupWithResponse("testrg", "testpostgresInstances", com.azure.core.util.Context.NONE); + } +} +``` + +### PostgresInstances_List + +```java +/** + * Samples for PostgresInstances List. + */ +public final class PostgresInstancesListSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListSubscriptionPostgresInstance.json + */ + /** + * Sample code: Gets all Postgres Instance in a subscription. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllPostgresInstanceInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances().list(com.azure.core.util.Context.NONE); + } +} +``` + +### PostgresInstances_ListByResourceGroup + +```java +/** + * Samples for PostgresInstances ListByResourceGroup. + */ +public final class PostgresInstancesListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListByResourceGroupPostgresInstance.json + */ + /** + * Sample code: Gets all postgres Instances in a resource group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllPostgresInstancesInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} +``` + +### PostgresInstances_Update + +```java +import com.azure.resourcemanager.azurearcdata.models.PostgresInstance; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for PostgresInstances Update. + */ +public final class PostgresInstancesUpdateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * UpdatePostgresInstance.json + */ + /** + * Sample code: Updates a postgres Instances tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + updatesAPostgresInstancesTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + PostgresInstance resource = manager.postgresInstances() + .getByResourceGroupWithResponse("testrg", "testpostgresInstance", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval")).apply(); + } + + // Use "Map.of" if available + @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; + } +} +``` + ### SqlManagedInstances_Create ```java +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryInformation; import com.azure.resourcemanager.azurearcdata.models.ArcSqlManagedInstanceLicenseType; import com.azure.resourcemanager.azurearcdata.models.BasicLoginInformation; import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; import com.azure.resourcemanager.azurearcdata.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurearcdata.models.K8SActiveDirectory; +import com.azure.resourcemanager.azurearcdata.models.K8SActiveDirectoryConnector; +import com.azure.resourcemanager.azurearcdata.models.K8SNetworkSettings; import com.azure.resourcemanager.azurearcdata.models.K8SResourceRequirements; import com.azure.resourcemanager.azurearcdata.models.K8SScheduling; import com.azure.resourcemanager.azurearcdata.models.K8SSchedulingOptions; +import com.azure.resourcemanager.azurearcdata.models.K8SSecurity; +import com.azure.resourcemanager.azurearcdata.models.K8SSettings; +import com.azure.resourcemanager.azurearcdata.models.K8StransparentDataEncryption; +import com.azure.resourcemanager.azurearcdata.models.KeytabInformation; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SRaw; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SSpec; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceProperties; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceSku; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceSkuTier; +import java.util.Arrays; import java.util.HashMap; import java.util.Map; -/** Samples for SqlManagedInstances Create. */ +/** + * Samples for SqlManagedInstances Create. + */ public final class SqlManagedInstancesCreateSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/CreateOrUpdateSqlManagedInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateSqlManagedInstance.json */ /** * Sample code: Create or update a SQL Managed Instance. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void createOrUpdateASQLManagedInstance( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager - .sqlManagedInstances() + public static void + createOrUpdateASQLManagedInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlManagedInstances() .define("testsqlManagedInstance") .withRegion("northeurope") .withExistingResourceGroup("testrg") .withProperties( - new SqlManagedInstanceProperties() - .withAdmin("Admin user") + new SqlManagedInstanceProperties().withAdmin("Admin user") .withStartTime("Instance start time") .withEndTime("Instance end time") .withK8SRaw( new SqlManagedInstanceK8SRaw() - .withSpec( - new SqlManagedInstanceK8SSpec() - .withScheduling( - new K8SScheduling() - .withDefaultProperty( - new K8SSchedulingOptions() - .withResources( - new K8SResourceRequirements() - .withRequests( - mapOf( - "additionalProperty", - "additionalValue", - "cpu", - "1", - "memory", - "8Gi")) - .withLimits( - mapOf( - "additionalProperty", - "additionalValue", - "cpu", - "1", - "memory", - "8Gi")) - .withAdditionalProperties(mapOf())) + .withSpec(new SqlManagedInstanceK8SSpec() + .withScheduling( + new K8SScheduling() + .withDefaultProperty( + new K8SSchedulingOptions() + .withResources(new K8SResourceRequirements() + .withRequests(mapOf("additionalProperty", "additionalValue", "cpu", + "1", "memory", "8Gi")) + .withLimits(mapOf("additionalProperty", "additionalValue", "cpu", + "1", "memory", "8Gi")) .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf())) - .withReplicas(1) + .withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf())) + .withReplicas(1) + .withSecurity(new K8SSecurity() + .withAdminLoginSecret("fakeTokenPlaceholder") + .withServiceCertificateSecret("fakeTokenPlaceholder") + .withActiveDirectory(new K8SActiveDirectory() + .withConnector(new K8SActiveDirectoryConnector().withName("Name of connector") + .withNamespace("Namespace of connector")) + .withAccountName("Account name") + .withKeytabSecret("fakeTokenPlaceholder") + .withEncryptionTypes( + Arrays.asList("Encryption type item1, Encryption type item2,..."))) + .withTransparentDataEncryption( + new K8StransparentDataEncryption().withMode("SystemManaged")) .withAdditionalProperties(mapOf())) + .withSettings( + new K8SSettings().withNetwork(new K8SNetworkSettings().withForceencryption(0) + .withTlsciphers( + "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384") + .withTlsprotocols("1.2")).withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf())) .withAdditionalProperties(mapOf("additionalProperty", 1234))) .withBasicLoginInformation( new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withActiveDirectoryInformation(new ActiveDirectoryInformation() + .withKeytabInformation(new KeytabInformation().withKeytab("fakeTokenPlaceholder"))) .withLicenseType(ArcSqlManagedInstanceLicenseType.LICENSE_INCLUDED) .withClusterId( "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s") .withExtensionId( "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension")) .withTags(mapOf("mytag", "myval")) - .withExtendedLocation( - new ExtendedLocation() - .withName( - "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation") - .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) .withSku(new SqlManagedInstanceSku().withTier(SqlManagedInstanceSkuTier.GENERAL_PURPOSE).withDev(true)) .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -359,14 +906,18 @@ public final class SqlManagedInstancesCreateSamples { ### SqlManagedInstances_Delete ```java -/** Samples for SqlManagedInstances Delete. */ +/** + * Samples for SqlManagedInstances Delete. + */ public final class SqlManagedInstancesDeleteSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/DeleteSqlManagedInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteSqlManagedInstance.json */ /** * Sample code: Delete a SQL Instance. - * + * * @param manager Entry point to AzureArcDataManager. */ public static void deleteASQLInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { @@ -378,19 +929,22 @@ public final class SqlManagedInstancesDeleteSamples { ### SqlManagedInstances_GetByResourceGroup ```java -/** Samples for SqlManagedInstances GetByResourceGroup. */ +/** + * Samples for SqlManagedInstances GetByResourceGroup. + */ public final class SqlManagedInstancesGetByResourceGroupSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/GetSqlManagedInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetSqlManagedInstance.json */ /** * Sample code: Updates a SQL Instance tags. - * + * * @param manager Entry point to AzureArcDataManager. */ public static void updatesASQLInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager - .sqlManagedInstances() + manager.sqlManagedInstances() .getByResourceGroupWithResponse("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE); } } @@ -399,18 +953,22 @@ public final class SqlManagedInstancesGetByResourceGroupSamples { ### SqlManagedInstances_List ```java -/** Samples for SqlManagedInstances List. */ +/** + * Samples for SqlManagedInstances List. + */ public final class SqlManagedInstancesListSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ListSubscriptionSqlManagedInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListSubscriptionSqlManagedInstance.json */ /** * Sample code: Gets all SQL Instance in a subscription. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void getsAllSQLInstanceInASubscription( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + public static void + getsAllSQLInstanceInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { manager.sqlManagedInstances().list(com.azure.core.util.Context.NONE); } } @@ -419,18 +977,22 @@ public final class SqlManagedInstancesListSamples { ### SqlManagedInstances_ListByResourceGroup ```java -/** Samples for SqlManagedInstances ListByResourceGroup. */ +/** + * Samples for SqlManagedInstances ListByResourceGroup. + */ public final class SqlManagedInstancesListByResourceGroupSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ListByResourceGroupSqlManagedInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListByResourceGroupSqlManagedInstance.json */ /** * Sample code: Gets all SQL Instance in a resource group. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void getsAllSQLInstanceInAResourceGroup( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + public static void + getsAllSQLInstanceInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { manager.sqlManagedInstances().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); } } @@ -443,25 +1005,28 @@ import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstance; import java.util.HashMap; import java.util.Map; -/** Samples for SqlManagedInstances Update. */ +/** + * Samples for SqlManagedInstances Update. + */ public final class SqlManagedInstancesUpdateSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/UpdateSqlManagedInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * UpdateSqlManagedInstance.json */ /** * Sample code: Updates a sql Instance tags. - * + * * @param manager Entry point to AzureArcDataManager. */ public static void updatesASqlInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - SqlManagedInstance resource = - manager - .sqlManagedInstances() - .getByResourceGroupWithResponse("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE) - .getValue(); + SqlManagedInstance resource = manager.sqlManagedInstances() + .getByResourceGroupWithResponse("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE) + .getValue(); resource.update().withTags(mapOf("mytag", "myval")).apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -475,57 +1040,94 @@ public final class SqlManagedInstancesUpdateSamples { } ``` -### SqlServerInstances_Create +### SqlServerAvailabilityGroups_AddDatabases ```java -import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType; -import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus; -import com.azure.resourcemanager.azurearcdata.models.DefenderStatus; -import com.azure.resourcemanager.azurearcdata.models.EditionType; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties; -import com.azure.resourcemanager.azurearcdata.models.SqlVersion; -import java.time.OffsetDateTime; +import com.azure.resourcemanager.azurearcdata.models.Databases; +import java.util.Arrays; + +/** + * Samples for SqlServerAvailabilityGroups AddDatabases. + */ +public final class SqlServerAvailabilityGroupsAddDatabasesSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * AddDatabasesToAvailabilityGroup.json + */ + /** + * Sample code: add databases to this availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + addDatabasesToThisAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .addDatabasesWithResponse("testrg", "testSqlServer_INST1", "testAG", + new Databases().withValues(Arrays.asList("db1", "db2", "db3")), com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupConfigure; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupInfo; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesDatabases; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesReplicas; +import java.util.Arrays; import java.util.HashMap; import java.util.Map; -/** Samples for SqlServerInstances Create. */ -public final class SqlServerInstancesCreateSamples { +/** + * Samples for SqlServerAvailabilityGroups Create. + */ +public final class SqlServerAvailabilityGroupsCreateSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/CreateOrUpdateSqlServerInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateArcSqlServerAvailabilityGroup.json */ /** - * Sample code: Updates a SQL Server Instance tags. - * + * Sample code: Create a Arc Sql Server availability group. + * * @param manager Entry point to AzureArcDataManager. */ - public static void updatesASQLServerInstanceTags( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager - .sqlServerInstances() - .define("testsqlServerInstance") - .withRegion("northeurope") - .withExistingResourceGroup("testrg") - .withTags(mapOf("mytag", "myval")) + public static void + createAArcSqlServerAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .define("testAG") + .withRegion("southeastasia") + .withExistingSqlServerInstance("testrg", "testSqlServer_INST1") .withProperties( - new SqlServerInstanceProperties() - .withVersion(SqlVersion.SQL_SERVER_2017) - .withEdition(EditionType.DEVELOPER) - .withContainerResourceId("Arc Machine Name") - .withVCore("4") - .withStatus(ConnectionStatus.CONNECTED) - .withPatchLevel("patchlevel") - .withCollation("collation") - .withCurrentVersion("2008 R2") - .withInstanceName("name of instance") - .withTcpDynamicPorts("1433") - .withTcpStaticPorts("1433") - .withProductId("sql id") - .withLicenseType(ArcSqlServerLicenseType.FREE) - .withAzureDefenderStatusLastUpdated(OffsetDateTime.parse("2020-01-02T17:18:19.1234567Z")) - .withAzureDefenderStatus(DefenderStatus.PROTECTED)) + new SqlServerAvailabilityGroupResourceProperties() + .withInfo(new AvailabilityGroupInfo().withFailureConditionLevel(3) + .withHealthCheckTimeout(30000) + .withBasicFeatures(false) + .withDtcSupport(false) + .withDbFailover(true) + .withIsDistributed(false) + .withRequiredSynchronizedSecondariesToCommit(0) + .withIsContained(false)) + .withReplicas( + new SqlServerAvailabilityGroupResourcePropertiesReplicas().withValue(Arrays.asList( + new SqlAvailabilityGroupReplicaResourceProperties().withReplicaName("testSqlServer\\INST1") + .withConfigure(new AvailabilityGroupConfigure() + .withEndpointUrl("TCP://mytest60-0.mytest60-svc:5022") + .withSessionTimeout(10) + .withBackupPriority(50))))) + .withDatabases(new SqlServerAvailabilityGroupResourcePropertiesDatabases().withValue(Arrays.asList( + new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("db1"), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("db2"))))) + .withTags(mapOf("mytag", "myval")) .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -539,62 +1141,953 @@ public final class SqlServerInstancesCreateSamples { } ``` -### SqlServerInstances_Delete +### SqlServerAvailabilityGroups_CreateAvailabilityGroup ```java -/** Samples for SqlServerInstances Delete. */ -public final class SqlServerInstancesDeleteSamples { +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AutomatedBackupPreference; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateReplicaConfiguration; +import com.azure.resourcemanager.azurearcdata.models.ClusterType; +import com.azure.resourcemanager.azurearcdata.models.DbFailover; +import com.azure.resourcemanager.azurearcdata.models.DtcSupport; +import com.azure.resourcemanager.azurearcdata.models.FailureConditionLevel; +import com.azure.resourcemanager.azurearcdata.models.PrimaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupStaticIpListenerProperties; +import java.util.Arrays; + +/** + * Samples for SqlServerAvailabilityGroups CreateAvailabilityGroup. + */ +public final class SqlServerAvailabilityGroupsCreateAvailabilityGroupSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/DeleteSqlServerInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateSqlServerAvailabilityGroup.json */ /** - * Sample code: Delete a SQL Server Instance. - * + * Sample code: Create an availability group using this server for the primary replica. + * * @param manager Entry point to AzureArcDataManager. */ - public static void deleteASQLServerInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager.sqlServerInstances().delete("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE); + public static void createAnAvailabilityGroupUsingThisServerForThePrimaryReplica( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .createAvailabilityGroup("testrg", "testSqlServer_INST1", new AvailabilityGroupCreateUpdateConfiguration() + .withAvailabilityGroupName("myNewAg") + .withReplicas(Arrays.asList(new AvailabilityGroupCreateUpdateReplicaConfiguration().withServerInstance( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST1/") + .withEndpointName("inst1DBMEndpoint") + .withEndpointUrl("TCP://testSqlServer_INST1.testSqlserverDomain:5022") + .withEndpointConnectLogin("NT Server\\MSSSQLSERVER") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withBackupPriority(50) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.ALL) + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.ALL) + .withSessionTimeout(10), + new AvailabilityGroupCreateUpdateReplicaConfiguration().withServerInstance( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST2/") + .withEndpointName("inst2DBMEndpoint") + .withEndpointUrl("TCP://testSqlServer_INST2.testSqlserverDomain:5022") + .withEndpointConnectLogin("NT Server\\MSSSQLSERVER") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withBackupPriority(50) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.ALL) + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.ALL) + .withSessionTimeout(10))) + .withDatabases(Arrays.asList("database1", "database2")) + .withAutomatedBackupPreference(AutomatedBackupPreference.SECONDARY) + .withFailureConditionLevel(FailureConditionLevel.THREE) + .withHealthCheckTimeout(30000) + .withDbFailover(DbFailover.ON) + .withDtcSupport(DtcSupport.NONE) + .withRequiredSynchronizedSecondariesToCommit(0) + .withClusterType(ClusterType.WSFC) + .withListener(new SqlAvailabilityGroupStaticIpListenerProperties().withDnsName("myNewAgListener") + .withIpV4AddressesAndMasks(Arrays.asList( + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("192.1.168.5") + .withMask("255.255.255.0"), + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("10.1.168.5") + .withMask("255.255.255.0"))) + .withPort(1433)), + com.azure.core.util.Context.NONE); } } ``` -### SqlServerInstances_GetByResourceGroup +### SqlServerAvailabilityGroups_CreateDistributedAvailabilityGroup ```java -/** Samples for SqlServerInstances GetByResourceGroup. */ +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; + +/** + * Samples for SqlServerAvailabilityGroups CreateDistributedAvailabilityGroup. + */ +public final class SqlServerAvailabilityGroupsCreateDistributedAvailabilityGroupSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateSqlServerDistributedAvailabilityGroup.json + */ + /** + * Sample code: Create a distributed availability group using this server for the primary replica. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createADistributedAvailabilityGroupUsingThisServerForThePrimaryReplica( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .createDistributedAvailabilityGroup("testrg", "testSqlServer_INST1", + new DistributedAvailabilityGroupCreateUpdateConfiguration().withAvailabilityGroupName("myNewDag") + .withPrimaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST1/availabilityGroups/testAG1") + .withListenerUrl("TCP://testAG1.contoso.com:5022") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("myCert"))) + .withSecondaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST2/availabilityGroups/testAG2") + .withListenerUrl("TCP://testAG2.contoso.com:5022") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("myCert"))), + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_Delete + +```java +/** + * Samples for SqlServerAvailabilityGroups Delete. + */ +public final class SqlServerAvailabilityGroupsDeleteSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Deletes a availability group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + deletesAAvailabilityGroupResource(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .delete("testrg", "testsqlInstanceAvailabilityGroup", "testAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_DetailView + +```java +/** + * Samples for SqlServerAvailabilityGroups DetailView. + */ +public final class SqlServerAvailabilityGroupsDetailViewSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ViewArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: detail view for a server availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + detailViewForAServerAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .detailViewWithResponse("testrg", "testSqlServer_INST1", "testAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_Failover + +```java +/** + * Samples for SqlServerAvailabilityGroups Failover. + */ +public final class SqlServerAvailabilityGroupsFailoverSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * FailoverArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: availability group manual failover to this server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void availabilityGroupManualFailoverToThisServer( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .failoverWithResponse("testrg", "testSqlServer_INST1", "testAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_ForceFailoverAllowDataLoss + +```java +/** + * Samples for SqlServerAvailabilityGroups ForceFailoverAllowDataLoss. + */ +public final class SqlServerAvailabilityGroupsForceFailoverAllowDataLossSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ForceFailoverArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: availability group force failover to this server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + availabilityGroupForceFailoverToThisServer(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .forceFailoverAllowDataLossWithResponse("testrg", "testSqlServer_INST1", "testAG", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_Get + +```java +/** + * Samples for SqlServerAvailabilityGroups Get. + */ +public final class SqlServerAvailabilityGroupsGetSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Retrieves an Arc Sql Server availability group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesAnArcSqlServerAvailabilityGroupResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .getWithResponse("testrg", "testSqlServer_INST1", "testAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_List + +```java +/** + * Samples for SqlServerAvailabilityGroups List. + */ +public final class SqlServerAvailabilityGroupsListSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListBySqlServerInstanceAvailabilityGroup.json + */ + /** + * Sample code: Gets all availability groups associated with an Arc Enabled Sql server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllAvailabilityGroupsAssociatedWithAnArcEnabledSqlServer( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups().list("testrg", "testSqlServer_INST1", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_RemoveDatabases + +```java +import com.azure.resourcemanager.azurearcdata.models.Databases; +import java.util.Arrays; + +/** + * Samples for SqlServerAvailabilityGroups RemoveDatabases. + */ +public final class SqlServerAvailabilityGroupsRemoveDatabasesSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * RemoveDatabasesFromAvailabilityGroup.json + */ + /** + * Sample code: remove databases from this availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + removeDatabasesFromThisAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .removeDatabasesWithResponse("testrg", "testSqlServer_INST1", "testAG", + new Databases().withValues(Arrays.asList("db1")), com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_Update + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerAvailabilityGroups Update. + */ +public final class SqlServerAvailabilityGroupsUpdateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * UpdateArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Update an availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updateAnAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerAvailabilityGroupResource resource = manager.sqlServerAvailabilityGroups() + .getWithResponse("testrg", "testSqlServer_INST1", "testAG", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval1")).apply(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### SqlServerDatabases_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.BackupPolicy; +import com.azure.resourcemanager.azurearcdata.models.DatabaseCreateMode; +import com.azure.resourcemanager.azurearcdata.models.DatabaseState; +import com.azure.resourcemanager.azurearcdata.models.DifferentialBackupHours; +import com.azure.resourcemanager.azurearcdata.models.RecoveryMode; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesBackupInformation; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesDatabaseOptions; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerDatabases Create. + */ +public final class SqlServerDatabasesCreateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateArcSqlServerDatabase.json + */ + /** + * Sample code: Create a Arc Sql Server database. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createAArcSqlServerDatabase(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerDatabases() + .define("testdb") + .withRegion("southeastasia") + .withExistingSqlServerInstance("testrg", "testSqlServerInstance") + .withProperties(new SqlServerDatabaseResourceProperties().withCollationName("SQL_Latin1_General_CP1_CI_AS") + .withDatabaseCreationDate(OffsetDateTime.parse("2022-04-05T16:26:33.883Z")) + .withCompatibilityLevel(150) + .withSizeMB(150.0F) + .withSpaceAvailableMB(100.0F) + .withState(DatabaseState.ONLINE) + .withIsReadOnly(true) + .withRecoveryMode(RecoveryMode.FULL) + .withDatabaseOptions(new SqlServerDatabaseResourcePropertiesDatabaseOptions().withIsAutoCloseOn(true) + .withIsAutoShrinkOn(true) + .withIsAutoCreateStatsOn(true) + .withIsAutoUpdateStatsOn(true) + .withIsRemoteDataArchiveEnabled(true) + .withIsMemoryOptimizationEnabled(true) + .withIsEncrypted(true) + .withIsTrustworthyOn(true)) + .withBackupInformation(new SqlServerDatabaseResourcePropertiesBackupInformation() + .withLastFullBackup(OffsetDateTime.parse("2022-05-05T16:26:33.883Z")) + .withLastLogBackup(OffsetDateTime.parse("2022-05-10T16:26:33.883Z"))) + .withBackupPolicy(new BackupPolicy().withRetentionPeriodDays(1) + .withFullBackupDays(1) + .withDifferentialBackupHours(DifferentialBackupHours.ONE_TWO) + .withTransactionLogBackupMinutes(30)) + .withCreateMode(DatabaseCreateMode.POINT_IN_TIME_RESTORE) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/testSqlServerInstance/testsqlManagedInstance/databases/MyDatabase") + .withRestorePointInTime(OffsetDateTime.parse("2022-05-05T16:26:33.883Z"))) + .withTags(mapOf("mytag", "myval")) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### SqlServerDatabases_Delete + +```java +/** + * Samples for SqlServerDatabases Delete. + */ +public final class SqlServerDatabasesDeleteSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteArcSqlServerDatabase.json + */ + /** + * Sample code: Deletes a database resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deletesADatabaseResource(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerDatabases() + .delete("testrg", "testsqlManagedInstance", "testdb", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerDatabases_Get + +```java +/** + * Samples for SqlServerDatabases Get. + */ +public final class SqlServerDatabasesGetSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetArcSqlServerDatabase.json + */ + /** + * Sample code: Retrieves an Arc Sql Server database resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + retrievesAnArcSqlServerDatabaseResource(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerDatabases() + .getWithResponse("testrg", "testSqlServerInstance", "testdb", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerDatabases_List + +```java +/** + * Samples for SqlServerDatabases List. + */ +public final class SqlServerDatabasesListSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListBySqlServerInstanceDatabase.json + */ + /** + * Sample code: Gets all databases associated with an Arc Enabled Sql server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllDatabasesAssociatedWithAnArcEnabledSqlServer( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerDatabases().list("testrg", "testSqlServerInstance", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerDatabases_Update + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerDatabases Update. + */ +public final class SqlServerDatabasesUpdateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * UpdateSqlServerDatabase.json + */ + /** + * Sample code: Update a database. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updateADatabase(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerDatabaseResource resource = manager.sqlServerDatabases() + .getWithResponse("testrg", "testsqlManagedInstance", "testdb", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval1")).apply(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### SqlServerEsuLicenses_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseProperties; +import com.azure.resourcemanager.azurearcdata.models.State; +import com.azure.resourcemanager.azurearcdata.models.Version; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerEsuLicenses Create. + */ +public final class SqlServerEsuLicensesCreateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateSqlServerEsuLicense.json + */ + /** + * Sample code: Updates a SQL Server ESU license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updatesASQLServerESULicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses() + .define("testsqlServerEsuLicense") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withProperties(new SqlServerEsuLicenseProperties().withBillingPlan(BillingPlan.PAYG) + .withVersion(Version.SQL_SERVER_2012) + .withPhysicalCores(24) + .withActivationState(State.INACTIVE) + .withScopeType(ScopeType.SUBSCRIPTION)) + .withTags(mapOf("mytag", "myval")) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### SqlServerEsuLicenses_Delete + +```java +/** + * Samples for SqlServerEsuLicenses Delete. + */ +public final class SqlServerEsuLicensesDeleteSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteSqlServerEsuLicense.json + */ + /** + * Sample code: Delete a SQL Server ESU license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deleteASQLServerESULicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses() + .deleteByResourceGroupWithResponse("testrg", "testsqlServerEsuLicense", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerEsuLicenses_GetByResourceGroup + +```java +/** + * Samples for SqlServerEsuLicenses GetByResourceGroup. + */ +public final class SqlServerEsuLicensesGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetSqlServerEsuLicense.json + */ + /** + * Sample code: Gets a SQL Server ESU license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsASQLServerESULicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses() + .getByResourceGroupWithResponse("testrg", "testsqlServerEsuLicense", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerEsuLicenses_List + +```java +/** + * Samples for SqlServerEsuLicenses List. + */ +public final class SqlServerEsuLicensesListSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListSubscriptionSqlServerEsuLicense.json + */ + /** + * Sample code: Gets all SQL Server ESU licenses in a subscription. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllSQLServerESULicensesInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses().list(com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerEsuLicenses_ListByResourceGroup + +```java +/** + * Samples for SqlServerEsuLicenses ListByResourceGroup. + */ +public final class SqlServerEsuLicensesListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListByResourceGroupSqlServerEsuLicense.json + */ + /** + * Sample code: Gets all SQL Server ESU licenses in a resource group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllSQLServerESULicensesInAResourceGroup( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerEsuLicenses_Update + +```java +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicense; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdateProperties; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerEsuLicenses Update. + */ +public final class SqlServerEsuLicensesUpdateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * UpdateSqlServerEsuLicense.json + */ + /** + * Sample code: Patch a SQL Server ESU license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void patchASQLServerESULicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerEsuLicense resource = manager.sqlServerEsuLicenses() + .getByResourceGroupWithResponse("testrg", "testsqlServerEsuLicense", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("mytag", "myval")) + .withProperties(new SqlServerEsuLicenseUpdateProperties().withBillingPlan(BillingPlan.PAID) + .withPhysicalCores(28) + .withActivationState(State.ACTIVE)) + .apply(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### SqlServerInstances_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.BackupPolicy; +import com.azure.resourcemanager.azurearcdata.models.ClientConnection; +import com.azure.resourcemanager.azurearcdata.models.DifferentialBackupHours; +import com.azure.resourcemanager.azurearcdata.models.EditionType; +import com.azure.resourcemanager.azurearcdata.models.HostType; +import com.azure.resourcemanager.azurearcdata.models.Migration; +import com.azure.resourcemanager.azurearcdata.models.MigrationAssessment; +import com.azure.resourcemanager.azurearcdata.models.Monitoring; +import com.azure.resourcemanager.azurearcdata.models.ServiceType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlVersion; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerInstances Create. + */ +public final class SqlServerInstancesCreateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateSqlServerInstance.json + */ + /** + * Sample code: Updates a SQL Server Instance tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + updatesASQLServerInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .define("testsqlServerInstance") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withTags(mapOf("mytag", "myval")) + .withProperties(new SqlServerInstanceProperties().withVersion(SqlVersion.SQL_SERVER_2012) + .withEdition(EditionType.DEVELOPER) + .withCores("4") + .withInstanceName("name of instance") + .withHostType(HostType.PHYSICAL_SERVER) + .withBackupPolicy(new BackupPolicy().withRetentionPeriodDays(1) + .withFullBackupDays(1) + .withDifferentialBackupHours(DifferentialBackupHours.ONE_TWO) + .withTransactionLogBackupMinutes(30)) + .withMonitoring(new Monitoring().withEnabled(false)) + .withMigration(new Migration().withAssessment(new MigrationAssessment().withEnabled(false))) + .withClientConnection(new ClientConnection().withEnabled(false)) + .withServiceType(ServiceType.ENGINE)) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### SqlServerInstances_Delete + +```java +/** + * Samples for SqlServerInstances Delete. + */ +public final class SqlServerInstancesDeleteSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteSqlServerInstance.json + */ + /** + * Sample code: Delete a SQL Server Instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deleteASQLServerInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances().delete("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_GetByResourceGroup + +```java +/** + * Samples for SqlServerInstances GetByResourceGroup. + */ public final class SqlServerInstancesGetByResourceGroupSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/GetSqlServerInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void updatesASQLServerInstanceTags( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager - .sqlServerInstances() + public static void + updatesASQLServerInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() .getByResourceGroupWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE); } } ``` +### SqlServerInstances_GetJobsStatus + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusRequest; + +/** + * Samples for SqlServerInstances GetJobsStatus. + */ +public final class SqlServerInstancesGetJobsStatusSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetSqlServerInstanceJobsStatus.json + */ + /** + * Sample code: Retrieves Arc SQL Server instance jobs status. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + retrievesArcSQLServerInstanceJobsStatus(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getJobsStatusWithResponse("testrg", "testsqlserver", + new SqlServerInstanceJobsStatusRequest().withFeatureName("MigrationAssessment").withJobType("Ondemand"), + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_GetTelemetry + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryRequest; +import java.time.OffsetDateTime; + +/** + * Samples for SqlServerInstances GetTelemetry. + */ +public final class SqlServerInstancesGetTelemetrySamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetSqlServerInstanceTelemetry.json + */ + /** + * Sample code: Retrieves Arc SQL Server cpu utilization telemetry. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesArcSQLServerCpuUtilizationTelemetry( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getTelemetry("testrg", "testsqlserver", + new SqlServerInstanceTelemetryRequest().withDatasetName("sqlserver_storage_io") + .withStartTime(OffsetDateTime.parse("2023-09-30T00:00:00Z")), + com.azure.core.util.Context.NONE); + } +} +``` + ### SqlServerInstances_List ```java -/** Samples for SqlServerInstances List. */ +/** + * Samples for SqlServerInstances List. + */ public final class SqlServerInstancesListSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ListSubscriptionSqlServerInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListSubscriptionSqlServerInstance.json */ /** * Sample code: Gets all SQL Server Instance in a subscription. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void getsAllSQLServerInstanceInASubscription( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + public static void + getsAllSQLServerInstanceInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { manager.sqlServerInstances().list(com.azure.core.util.Context.NONE); } } @@ -603,23 +2096,102 @@ public final class SqlServerInstancesListSamples { ### SqlServerInstances_ListByResourceGroup ```java -/** Samples for SqlServerInstances ListByResourceGroup. */ +/** + * Samples for SqlServerInstances ListByResourceGroup. + */ public final class SqlServerInstancesListByResourceGroupSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ListByResourceGroupSqlServerInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListByResourceGroupSqlServerInstance.json */ /** * Sample code: Gets all SQL Server Instance in a resource group. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void getsAllSQLServerInstanceInAResourceGroup( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + public static void + getsAllSQLServerInstanceInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { manager.sqlServerInstances().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); } } ``` +### SqlServerInstances_PostUpgrade + +```java +/** + * Samples for SqlServerInstances PostUpgrade. + */ +public final class SqlServerInstancesPostUpgradeSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * PostUpgradeSqlServerInstance.json + */ + /** + * Sample code: Post AUM Upgrade to complete SQL Instance Upgrade Process. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void postAUMUpgradeToCompleteSQLInstanceUpgradeProcess( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .postUpgradeWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_PreUpgrade + +```java +/** + * Samples for SqlServerInstances PreUpgrade. + */ +public final class SqlServerInstancesPreUpgradeSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * PreUpgradeSqlServerInstance.json + */ + /** + * Sample code: Prepare SQL server instance for AUM Upgrade. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + prepareSQLServerInstanceForAUMUpgrade(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .preUpgradeWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_RunMigrationAssessment + +```java +/** + * Samples for SqlServerInstances RunMigrationAssessment. + */ +public final class SqlServerInstancesRunMigrationAssessmentSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * RunMigrationAssessmentSqlServerInstance.json + */ + /** + * Sample code: Trigger migration assessment run on sql server instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void triggerMigrationAssessmentRunOnSqlServerInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .runMigrationAssessmentWithResponse("testrg", "testsqlserver", com.azure.core.util.Context.NONE); + } +} +``` + ### SqlServerInstances_Update ```java @@ -627,26 +2199,221 @@ import com.azure.resourcemanager.azurearcdata.models.SqlServerInstance; import java.util.HashMap; import java.util.Map; -/** Samples for SqlServerInstances Update. */ +/** + * Samples for SqlServerInstances Update. + */ public final class SqlServerInstancesUpdateSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/UpdateSqlServerInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * UpdateSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void updatesASQLServerInstanceTags( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - SqlServerInstance resource = - manager - .sqlServerInstances() - .getByResourceGroupWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE) - .getValue(); + public static void + updatesASQLServerInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerInstance resource = manager.sqlServerInstances() + .getByResourceGroupWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval")).apply(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### SqlServerLicenses_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.ActivationState; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.LicenseCategory; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerLicenses Create. + */ +public final class SqlServerLicensesCreateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateSqlServerLicense.json + */ + /** + * Sample code: Updates a SQL Server license tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + updatesASQLServerLicenseTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses() + .define("testsqlServerLicense") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withProperties(new SqlServerLicenseProperties().withBillingPlan(BillingPlan.PAYG) + .withPhysicalCores(24) + .withLicenseCategory(LicenseCategory.CORE) + .withActivationState(ActivationState.DEACTIVATED) + .withScopeType(ScopeType.SUBSCRIPTION)) + .withTags(mapOf("mytag", "myval")) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### SqlServerLicenses_Delete + +```java +/** + * Samples for SqlServerLicenses Delete. + */ +public final class SqlServerLicensesDeleteSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteSqlServerLicense.json + */ + /** + * Sample code: Delete a SQL Server license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deleteASQLServerLicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses() + .deleteByResourceGroupWithResponse("testrg", "testsqlServerLicense", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerLicenses_GetByResourceGroup + +```java +/** + * Samples for SqlServerLicenses GetByResourceGroup. + */ +public final class SqlServerLicensesGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetSqlServerLicense.json + */ + /** + * Sample code: Gets a SQL Server license tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsASQLServerLicenseTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses() + .getByResourceGroupWithResponse("testrg", "testsqlServerLicense", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerLicenses_List + +```java +/** + * Samples for SqlServerLicenses List. + */ +public final class SqlServerLicensesListSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListSubscriptionSqlServerLicense.json + */ + /** + * Sample code: Gets all SQL Server license in a subscription. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllSQLServerLicenseInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses().list(com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerLicenses_ListByResourceGroup + +```java +/** + * Samples for SqlServerLicenses ListByResourceGroup. + */ +public final class SqlServerLicensesListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListByResourceGroupSqlServerLicense.json + */ + /** + * Sample code: Gets all SQL Server license in a resource group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllSQLServerLicenseInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerLicenses_Update + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicense; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerLicenses Update. + */ +public final class SqlServerLicensesUpdateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * UpdateSqlServerLicense.json + */ + /** + * Sample code: Patch a SQL Server license tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void patchASQLServerLicenseTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerLicense resource = manager.sqlServerLicenses() + .getByResourceGroupWithResponse("testrg", "testsqlServerLicense", com.azure.core.util.Context.NONE) + .getValue(); resource.update().withTags(mapOf("mytag", "myval")).apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/pom.xml b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/pom.xml index c8253816f2c0..a5a293dd2528 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/pom.xml +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/pom.xml @@ -1,3 +1,8 @@ + 4.0.0 @@ -13,7 +18,7 @@ jar Microsoft Azure SDK for AzureArcData Management - This package contains Microsoft Azure SDK for AzureArcData Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. Package tag package-2021-08-01. + This package contains Microsoft Azure SDK for AzureArcData Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. Package tag package-preview-2024-05. https://github.com/Azure/azure-sdk-for-java @@ -38,8 +43,10 @@ UTF-8 - true - - + 0 + 0 + true + false @@ -57,12 +64,6 @@ azure-core-test 1.27.0-beta.1 test - - - com.azure - azure-core-http-jdk-httpclient - - com.azure @@ -76,8 +77,6 @@ 4.11.0 test - - net.bytebuddy byte-buddy diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/AzureArcDataManager.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/AzureArcDataManager.java index 3cb9c5e4303a..39ba7e9f995c 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/AzureArcDataManager.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/AzureArcDataManager.java @@ -24,15 +24,29 @@ import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.azurearcdata.fluent.AzureArcDataManagementClient; +import com.azure.resourcemanager.azurearcdata.implementation.ActiveDirectoryConnectorsImpl; import com.azure.resourcemanager.azurearcdata.implementation.AzureArcDataManagementClientBuilder; import com.azure.resourcemanager.azurearcdata.implementation.DataControllersImpl; +import com.azure.resourcemanager.azurearcdata.implementation.FailoverGroupsImpl; import com.azure.resourcemanager.azurearcdata.implementation.OperationsImpl; +import com.azure.resourcemanager.azurearcdata.implementation.PostgresInstancesImpl; import com.azure.resourcemanager.azurearcdata.implementation.SqlManagedInstancesImpl; +import com.azure.resourcemanager.azurearcdata.implementation.SqlServerAvailabilityGroupsImpl; +import com.azure.resourcemanager.azurearcdata.implementation.SqlServerDatabasesImpl; +import com.azure.resourcemanager.azurearcdata.implementation.SqlServerEsuLicensesImpl; import com.azure.resourcemanager.azurearcdata.implementation.SqlServerInstancesImpl; +import com.azure.resourcemanager.azurearcdata.implementation.SqlServerLicensesImpl; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectors; import com.azure.resourcemanager.azurearcdata.models.DataControllers; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroups; import com.azure.resourcemanager.azurearcdata.models.Operations; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstances; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstances; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroups; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabases; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenses; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstances; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenses; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.ArrayList; @@ -41,35 +55,48 @@ import java.util.stream.Collectors; /** - * Entry point to AzureArcDataManager. The AzureArcData management API provides a RESTful set of web APIs to manage - * Azure Data Services on Azure Arc Resources. + * Entry point to AzureArcDataManager. + * The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc + * Resources. */ public final class AzureArcDataManager { private Operations operations; private SqlManagedInstances sqlManagedInstances; + private FailoverGroups failoverGroups; + private SqlServerInstances sqlServerInstances; + private SqlServerLicenses sqlServerLicenses; + private DataControllers dataControllers; + private ActiveDirectoryConnectors activeDirectoryConnectors; + + private PostgresInstances postgresInstances; + + private SqlServerAvailabilityGroups sqlServerAvailabilityGroups; + + private SqlServerDatabases sqlServerDatabases; + + private SqlServerEsuLicenses sqlServerEsuLicenses; + private final AzureArcDataManagementClient clientObject; private AzureArcDataManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = - new AzureArcDataManagementClientBuilder() - .pipeline(httpPipeline) - .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) - .subscriptionId(profile.getSubscriptionId()) - .defaultPollInterval(defaultPollInterval) - .buildClient(); + this.clientObject = new AzureArcDataManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); } /** * Creates an instance of AzureArcData service API entry point. - * + * * @param credential the credential to use. * @param profile the Azure profile for client. * @return the AzureArcData service API instance. @@ -82,7 +109,7 @@ public static AzureArcDataManager authenticate(TokenCredential credential, Azure /** * Creates an instance of AzureArcData service API entry point. - * + * * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. * @param profile the Azure profile for client. * @return the AzureArcData service API instance. @@ -95,14 +122,16 @@ public static AzureArcDataManager authenticate(HttpPipeline httpPipeline, AzureP /** * Gets a Configurable instance that can be used to create AzureArcDataManager with optional configuration. - * + * * @return the Configurable instance allowing configurations. */ public static Configurable configure() { return new AzureArcDataManager.Configurable(); } - /** The Configurable allowing configurations to be set. */ + /** + * The Configurable allowing configurations to be set. + */ public static final class Configurable { private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); @@ -174,8 +203,8 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) { /** * Sets the retry options for the HTTP pipeline retry policy. - * - *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + *

+ * 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. @@ -192,8 +221,8 @@ public Configurable withRetryOptions(RetryOptions retryOptions) { * @return the configurable object itself. */ public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = - Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); if (this.defaultPollInterval.isNegative()) { throw LOGGER .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); @@ -213,15 +242,13 @@ public AzureArcDataManager authenticate(TokenCredential credential, AzureProfile Objects.requireNonNull(profile, "'profile' cannot be null."); StringBuilder userAgentBuilder = new StringBuilder(); - userAgentBuilder - .append("azsdk-java") + userAgentBuilder.append("azsdk-java") .append("-") .append("com.azure.resourcemanager.azurearcdata") .append("/") - .append("1.0.0-beta.3"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { - userAgentBuilder - .append(" (") + userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) .append("; ") .append(Configuration.getGlobalConfiguration().get("os.name")) @@ -246,38 +273,28 @@ public AzureArcDataManager authenticate(TokenCredential credential, AzureProfile 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())); + 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())); + 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(); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); return new AzureArcDataManager(httpPipeline, profile, defaultPollInterval); } } /** * Gets the resource collection API of Operations. - * + * * @return Resource collection API of Operations. */ public Operations operations() { @@ -289,7 +306,7 @@ public Operations operations() { /** * Gets the resource collection API of SqlManagedInstances. It manages SqlManagedInstance. - * + * * @return Resource collection API of SqlManagedInstances. */ public SqlManagedInstances sqlManagedInstances() { @@ -299,9 +316,21 @@ public SqlManagedInstances sqlManagedInstances() { return sqlManagedInstances; } + /** + * Gets the resource collection API of FailoverGroups. It manages FailoverGroupResource. + * + * @return Resource collection API of FailoverGroups. + */ + public FailoverGroups failoverGroups() { + if (this.failoverGroups == null) { + this.failoverGroups = new FailoverGroupsImpl(clientObject.getFailoverGroups(), this); + } + return failoverGroups; + } + /** * Gets the resource collection API of SqlServerInstances. It manages SqlServerInstance. - * + * * @return Resource collection API of SqlServerInstances. */ public SqlServerInstances sqlServerInstances() { @@ -311,9 +340,21 @@ public SqlServerInstances sqlServerInstances() { return sqlServerInstances; } + /** + * Gets the resource collection API of SqlServerLicenses. It manages SqlServerLicense. + * + * @return Resource collection API of SqlServerLicenses. + */ + public SqlServerLicenses sqlServerLicenses() { + if (this.sqlServerLicenses == null) { + this.sqlServerLicenses = new SqlServerLicensesImpl(clientObject.getSqlServerLicenses(), this); + } + return sqlServerLicenses; + } + /** * Gets the resource collection API of DataControllers. It manages DataControllerResource. - * + * * @return Resource collection API of DataControllers. */ public DataControllers dataControllers() { @@ -324,8 +365,72 @@ public DataControllers dataControllers() { } /** - * @return Wrapped service client AzureArcDataManagementClient providing direct access to the underlying - * auto-generated API implementation, based on Azure REST API. + * Gets the resource collection API of ActiveDirectoryConnectors. It manages ActiveDirectoryConnectorResource. + * + * @return Resource collection API of ActiveDirectoryConnectors. + */ + public ActiveDirectoryConnectors activeDirectoryConnectors() { + if (this.activeDirectoryConnectors == null) { + this.activeDirectoryConnectors + = new ActiveDirectoryConnectorsImpl(clientObject.getActiveDirectoryConnectors(), this); + } + return activeDirectoryConnectors; + } + + /** + * Gets the resource collection API of PostgresInstances. It manages PostgresInstance. + * + * @return Resource collection API of PostgresInstances. + */ + public PostgresInstances postgresInstances() { + if (this.postgresInstances == null) { + this.postgresInstances = new PostgresInstancesImpl(clientObject.getPostgresInstances(), this); + } + return postgresInstances; + } + + /** + * Gets the resource collection API of SqlServerAvailabilityGroups. It manages SqlServerAvailabilityGroupResource. + * + * @return Resource collection API of SqlServerAvailabilityGroups. + */ + public SqlServerAvailabilityGroups sqlServerAvailabilityGroups() { + if (this.sqlServerAvailabilityGroups == null) { + this.sqlServerAvailabilityGroups + = new SqlServerAvailabilityGroupsImpl(clientObject.getSqlServerAvailabilityGroups(), this); + } + return sqlServerAvailabilityGroups; + } + + /** + * Gets the resource collection API of SqlServerDatabases. It manages SqlServerDatabaseResource. + * + * @return Resource collection API of SqlServerDatabases. + */ + public SqlServerDatabases sqlServerDatabases() { + if (this.sqlServerDatabases == null) { + this.sqlServerDatabases = new SqlServerDatabasesImpl(clientObject.getSqlServerDatabases(), this); + } + return sqlServerDatabases; + } + + /** + * Gets the resource collection API of SqlServerEsuLicenses. It manages SqlServerEsuLicense. + * + * @return Resource collection API of SqlServerEsuLicenses. + */ + public SqlServerEsuLicenses sqlServerEsuLicenses() { + if (this.sqlServerEsuLicenses == null) { + this.sqlServerEsuLicenses = new SqlServerEsuLicensesImpl(clientObject.getSqlServerEsuLicenses(), this); + } + return sqlServerEsuLicenses; + } + + /** + * Gets wrapped service client AzureArcDataManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client AzureArcDataManagementClient. */ public AzureArcDataManagementClient serviceClient() { return this.clientObject; diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/ActiveDirectoryConnectorsClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/ActiveDirectoryConnectorsClient.java new file mode 100644 index 000000000000..d43966b55d6c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/ActiveDirectoryConnectorsClient.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.azurearcdata.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.azurearcdata.fluent.models.ActiveDirectoryConnectorResourceInner; + +/** + * An instance of this class provides access to all the operations defined in ActiveDirectoryConnectorsClient. + */ +public interface ActiveDirectoryConnectorsClient { + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String dataControllerName); + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String dataControllerName, + Context context); + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ActiveDirectoryConnectorResourceInner> beginCreate( + String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName, + ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource); + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ActiveDirectoryConnectorResourceInner> beginCreate( + String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName, + ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource, Context context); + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActiveDirectoryConnectorResourceInner create(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource); + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActiveDirectoryConnectorResourceInner create(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource, + Context context); + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 dataControllerName, + String activeDirectoryConnectorName); + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 dataControllerName, + String activeDirectoryConnectorName, Context context); + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 dataControllerName, String activeDirectoryConnectorName); + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 dataControllerName, String activeDirectoryConnectorName, + Context context); + + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, Context context); + + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActiveDirectoryConnectorResourceInner get(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/AzureArcDataManagementClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/AzureArcDataManagementClient.java index da11f09fe2a9..b6895a3feb0b 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/AzureArcDataManagementClient.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/AzureArcDataManagementClient.java @@ -7,68 +7,119 @@ import com.azure.core.http.HttpPipeline; import java.time.Duration; -/** The interface for AzureArcDataManagementClient class. */ +/** + * The interface for AzureArcDataManagementClient class. + */ public interface AzureArcDataManagementClient { /** * Gets The ID of the Azure subscription. - * + * * @return the subscriptionId value. */ String getSubscriptionId(); /** * Gets server parameter. - * + * * @return the endpoint value. */ String getEndpoint(); /** * Gets Api Version. - * + * * @return the apiVersion value. */ String getApiVersion(); /** * Gets The HTTP pipeline to send requests through. - * + * * @return the httpPipeline value. */ HttpPipeline getHttpPipeline(); /** * Gets The default poll interval for long-running operation. - * + * * @return the defaultPollInterval value. */ Duration getDefaultPollInterval(); /** * Gets the OperationsClient object to access its operations. - * + * * @return the OperationsClient object. */ OperationsClient getOperations(); /** * Gets the SqlManagedInstancesClient object to access its operations. - * + * * @return the SqlManagedInstancesClient object. */ SqlManagedInstancesClient getSqlManagedInstances(); + /** + * Gets the FailoverGroupsClient object to access its operations. + * + * @return the FailoverGroupsClient object. + */ + FailoverGroupsClient getFailoverGroups(); + /** * Gets the SqlServerInstancesClient object to access its operations. - * + * * @return the SqlServerInstancesClient object. */ SqlServerInstancesClient getSqlServerInstances(); + /** + * Gets the SqlServerLicensesClient object to access its operations. + * + * @return the SqlServerLicensesClient object. + */ + SqlServerLicensesClient getSqlServerLicenses(); + /** * Gets the DataControllersClient object to access its operations. - * + * * @return the DataControllersClient object. */ DataControllersClient getDataControllers(); + + /** + * Gets the ActiveDirectoryConnectorsClient object to access its operations. + * + * @return the ActiveDirectoryConnectorsClient object. + */ + ActiveDirectoryConnectorsClient getActiveDirectoryConnectors(); + + /** + * Gets the PostgresInstancesClient object to access its operations. + * + * @return the PostgresInstancesClient object. + */ + PostgresInstancesClient getPostgresInstances(); + + /** + * Gets the SqlServerAvailabilityGroupsClient object to access its operations. + * + * @return the SqlServerAvailabilityGroupsClient object. + */ + SqlServerAvailabilityGroupsClient getSqlServerAvailabilityGroups(); + + /** + * Gets the SqlServerDatabasesClient object to access its operations. + * + * @return the SqlServerDatabasesClient object. + */ + SqlServerDatabasesClient getSqlServerDatabases(); + + /** + * Gets the SqlServerEsuLicensesClient object to access its operations. + * + * @return the SqlServerEsuLicensesClient object. + */ + SqlServerEsuLicensesClient getSqlServerEsuLicenses(); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/DataControllersClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/DataControllersClient.java index de132b816a5e..f2740d8bb633 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/DataControllersClient.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/DataControllersClient.java @@ -14,60 +14,62 @@ import com.azure.resourcemanager.azurearcdata.fluent.models.DataControllerResourceInner; import com.azure.resourcemanager.azurearcdata.models.DataControllerUpdate; -/** An instance of this class provides access to all the operations defined in DataControllersClient. */ +/** + * An instance of this class provides access to all the operations defined in DataControllersClient. + */ public interface DataControllersClient { /** * List dataController resources in the 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 the paginated response with {@link PagedIterable}. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(); /** * List dataController resources in the 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 the paginated response with {@link PagedIterable}. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(Context context); /** * List dataController resources in the resource group. - * + * * @param resourceGroupName The name of the Azure resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByResourceGroup(String resourceGroupName); /** * List dataController resources in the resource group. - * + * * @param resourceGroupName The name of the Azure resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByResourceGroup(String resourceGroupName, Context context); /** * Creates or replaces a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -80,9 +82,9 @@ SyncPoller, DataControllerResourceInner> /** * Creates or replaces a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -92,16 +94,14 @@ SyncPoller, DataControllerResourceInner> */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, DataControllerResourceInner> beginPutDataController( - String resourceGroupName, - String dataControllerName, - DataControllerResourceInner dataControllerResource, + String resourceGroupName, String dataControllerName, DataControllerResourceInner dataControllerResource, Context context); /** * Creates or replaces a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -109,14 +109,14 @@ SyncPoller, DataControllerResourceInner> * @return data controller resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - DataControllerResourceInner putDataController( - String resourceGroupName, String dataControllerName, DataControllerResourceInner dataControllerResource); + DataControllerResourceInner putDataController(String resourceGroupName, String dataControllerName, + DataControllerResourceInner dataControllerResource); /** * Creates or replaces a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -125,17 +125,14 @@ DataControllerResourceInner putDataController( * @return data controller resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - DataControllerResourceInner putDataController( - String resourceGroupName, - String dataControllerName, - DataControllerResourceInner dataControllerResource, - Context context); + DataControllerResourceInner putDataController(String resourceGroupName, String dataControllerName, + DataControllerResourceInner dataControllerResource, Context context); /** * Deletes a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -146,9 +143,9 @@ DataControllerResourceInner putDataController( /** * Deletes a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -156,14 +153,14 @@ DataControllerResourceInner putDataController( * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete( - String resourceGroupName, String dataControllerName, Context context); + SyncPoller, Void> beginDelete(String resourceGroupName, String dataControllerName, + Context context); /** * Deletes a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -173,9 +170,9 @@ SyncPoller, Void> beginDelete( /** * Deletes a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -186,9 +183,9 @@ SyncPoller, Void> beginDelete( /** * Retrieves a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -196,14 +193,14 @@ SyncPoller, Void> beginDelete( * @return data controller resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse( - String resourceGroupName, String dataControllerName, Context context); + Response getByResourceGroupWithResponse(String resourceGroupName, + String dataControllerName, Context context); /** * Retrieves a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -214,28 +211,41 @@ Response getByResourceGroupWithResponse( /** * Updates a dataController resource. - * + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller 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 the {@link SyncPoller} for polling of data controller resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DataControllerResourceInner> beginPatchDataController( + String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource); + + /** + * Updates a dataController resource. + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource The update data controller 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 data controller resource along with {@link Response}. + * @return the {@link SyncPoller} for polling of data controller resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response patchDataControllerWithResponse( - String resourceGroupName, - String dataControllerName, - DataControllerUpdate dataControllerResource, + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DataControllerResourceInner> beginPatchDataController( + String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource, Context context); /** * Updates a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource The update data controller resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -243,6 +253,22 @@ Response patchDataControllerWithResponse( * @return data controller resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - DataControllerResourceInner patchDataController( - String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource); + DataControllerResourceInner patchDataController(String resourceGroupName, String dataControllerName, + DataControllerUpdate dataControllerResource); + + /** + * Updates a dataController resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller 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 data controller resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataControllerResourceInner patchDataController(String resourceGroupName, String dataControllerName, + DataControllerUpdate dataControllerResource, Context context); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/FailoverGroupsClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/FailoverGroupsClient.java new file mode 100644 index 000000000000..e5bafd58fa25 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/FailoverGroupsClient.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.azurearcdata.fluent.models.FailoverGroupResourceInner; + +/** + * An instance of this class provides access to all the operations defined in FailoverGroupsClient. + */ +public interface FailoverGroupsClient { + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String sqlManagedInstanceName); + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String sqlManagedInstanceName, + Context context); + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FailoverGroupResourceInner> beginCreate(String resourceGroupName, + String sqlManagedInstanceName, String failoverGroupName, FailoverGroupResourceInner failoverGroupResource); + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FailoverGroupResourceInner> beginCreate(String resourceGroupName, + String sqlManagedInstanceName, String failoverGroupName, FailoverGroupResourceInner failoverGroupResource, + Context context); + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupResourceInner create(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, + FailoverGroupResourceInner failoverGroupResource); + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupResourceInner create(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, + FailoverGroupResourceInner failoverGroupResource, Context context); + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName); + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, Context context); + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName); + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, Context context); + + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, Context context); + + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupResourceInner get(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/OperationsClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/OperationsClient.java index 532d935f2205..070e61ecebaf 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/OperationsClient.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/OperationsClient.java @@ -10,28 +10,30 @@ import com.azure.core.util.Context; import com.azure.resourcemanager.azurearcdata.fluent.models.OperationInner; -/** An instance of this class provides access to all the operations defined in OperationsClient. */ +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ public interface OperationsClient { /** * Lists all of the available Azure Data Services on Azure Arc 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 result of the request to list Azure Data Services on Azure Arc operations as paginated response with - * {@link PagedIterable}. + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(); /** * Lists all of the available Azure Data Services on Azure Arc 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 result of the request to list Azure Data Services on Azure Arc operations as paginated response with - * {@link PagedIterable}. + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(Context context); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/PostgresInstancesClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/PostgresInstancesClient.java new file mode 100644 index 000000000000..14eea1d7f836 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/PostgresInstancesClient.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.azurearcdata.fluent.models.PostgresInstanceInner; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceUpdate; + +/** + * An instance of this class provides access to all the operations defined in PostgresInstancesClient. + */ +public interface PostgresInstancesClient { + /** + * List postgres Instance resources in the 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 PostgresInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List postgres Instance resources in the 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 PostgresInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a postgres Instances list by Resource group name as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a postgres Instances list by Resource group name as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String postgresInstanceName, Context context); + + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PostgresInstanceInner getByResourceGroup(String resourceGroupName, String postgresInstanceName); + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PostgresInstanceInner> beginCreate(String resourceGroupName, + String postgresInstanceName, PostgresInstanceInner resource); + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PostgresInstanceInner> beginCreate(String resourceGroupName, + String postgresInstanceName, PostgresInstanceInner resource, Context context); + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PostgresInstanceInner create(String resourceGroupName, String postgresInstanceName, PostgresInstanceInner resource); + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PostgresInstanceInner create(String resourceGroupName, String postgresInstanceName, PostgresInstanceInner resource, + Context context); + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 postgresInstanceName); + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 postgresInstanceName, + Context context); + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 postgresInstanceName); + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 postgresInstanceName, Context context); + + /** + * Updates a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param parameters The Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String postgresInstanceName, + PostgresInstanceUpdate parameters, Context context); + + /** + * Updates a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param parameters The Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PostgresInstanceInner update(String resourceGroupName, String postgresInstanceName, + PostgresInstanceUpdate parameters); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlManagedInstancesClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlManagedInstancesClient.java index 4c3bfd390ecb..64bf865d4c66 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlManagedInstancesClient.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlManagedInstancesClient.java @@ -14,11 +14,13 @@ import com.azure.resourcemanager.azurearcdata.fluent.models.SqlManagedInstanceInner; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceUpdate; -/** An instance of this class provides access to all the operations defined in SqlManagedInstancesClient. */ +/** + * An instance of this class provides access to all the operations defined in SqlManagedInstancesClient. + */ public interface SqlManagedInstancesClient { /** * List sqlManagedInstance resources in the 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 SqlManagedInstance as paginated response with {@link PagedIterable}. @@ -28,7 +30,7 @@ public interface SqlManagedInstancesClient { /** * List sqlManagedInstance resources in the 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. @@ -40,9 +42,9 @@ public interface SqlManagedInstancesClient { /** * List sqlManagedInstance resources in the resource group - * - *

Gets all sqlManagedInstances in a resource group. - * + * + * Gets all sqlManagedInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -54,9 +56,9 @@ public interface SqlManagedInstancesClient { /** * List sqlManagedInstance resources in the resource group - * - *

Gets all sqlManagedInstances in a resource group. - * + * + * Gets all sqlManagedInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -69,7 +71,7 @@ public interface SqlManagedInstancesClient { /** * Retrieves a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. @@ -79,12 +81,12 @@ public interface SqlManagedInstancesClient { * @return a SqlManagedInstance along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse( - String resourceGroupName, String sqlManagedInstanceName, Context context); + Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlManagedInstanceName, Context context); /** * Retrieves a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -97,9 +99,9 @@ Response getByResourceGroupWithResponse( /** * Creates or replaces a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -107,14 +109,14 @@ Response getByResourceGroupWithResponse( * @return the {@link SyncPoller} for polling of a SqlManagedInstance. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, SqlManagedInstanceInner> beginCreate( - String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance); + SyncPoller, SqlManagedInstanceInner> beginCreate(String resourceGroupName, + String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance); /** * Creates or replaces a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -123,17 +125,14 @@ SyncPoller, SqlManagedInstanceInner> beginCr * @return the {@link SyncPoller} for polling of a SqlManagedInstance. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, SqlManagedInstanceInner> beginCreate( - String resourceGroupName, - String sqlManagedInstanceName, - SqlManagedInstanceInner sqlManagedInstance, - Context context); + SyncPoller, SqlManagedInstanceInner> beginCreate(String resourceGroupName, + String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance, Context context); /** * Creates or replaces a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -141,14 +140,14 @@ SyncPoller, SqlManagedInstanceInner> beginCr * @return a SqlManagedInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - SqlManagedInstanceInner create( - String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance); + SqlManagedInstanceInner create(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceInner sqlManagedInstance); /** * Creates or replaces a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -157,17 +156,14 @@ SqlManagedInstanceInner create( * @return a SqlManagedInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - SqlManagedInstanceInner create( - String resourceGroupName, - String sqlManagedInstanceName, - SqlManagedInstanceInner sqlManagedInstance, - Context context); + SqlManagedInstanceInner create(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceInner sqlManagedInstance, Context context); /** * Deletes a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -178,9 +174,9 @@ SqlManagedInstanceInner create( /** * Deletes a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -188,14 +184,14 @@ SqlManagedInstanceInner create( * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete( - String resourceGroupName, String sqlManagedInstanceName, Context context); + SyncPoller, Void> beginDelete(String resourceGroupName, String sqlManagedInstanceName, + Context context); /** * Deletes a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -205,9 +201,9 @@ SyncPoller, Void> beginDelete( /** * Deletes a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -218,9 +214,9 @@ SyncPoller, Void> beginDelete( /** * Updates a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of sqlManagedInstance. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param parameters The SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -229,14 +225,14 @@ SyncPoller, Void> beginDelete( * @return a SqlManagedInstance along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse( - String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceUpdate parameters, Context context); + Response updateWithResponse(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceUpdate parameters, Context context); /** * Updates a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of sqlManagedInstance. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param parameters The SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -244,6 +240,6 @@ Response updateWithResponse( * @return a SqlManagedInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - SqlManagedInstanceInner update( - String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceUpdate parameters); + SqlManagedInstanceInner update(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceUpdate parameters); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerAvailabilityGroupsClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerAvailabilityGroupsClient.java new file mode 100644 index 000000000000..031d0a9c0819 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerAvailabilityGroupsClient.java @@ -0,0 +1,532 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.Databases; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupUpdate; + +/** + * An instance of this class provides access to all the operations defined in SqlServerAvailabilityGroupsClient. + */ +public interface SqlServerAvailabilityGroupsClient { + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group 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 arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource, Context context); + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group 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 arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner create(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Context context); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner get(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName); + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginUpdate(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate); + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginUpdate(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, Context context); + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner update(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate); + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner update(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, + Context context); + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response detailViewWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner detailView(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName); + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response failoverWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner failover(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName); + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response forceFailoverAllowDataLossWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner forceFailoverAllowDataLoss(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName); + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group 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 the {@link SyncPoller} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupCreateUpdateConfiguration createAgConfiguration); + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group 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 the {@link SyncPoller} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, Context context); + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner createAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration); + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner createAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, + Context context); + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group 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 the {@link SyncPoller} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateDistributedAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration); + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group 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 the {@link SyncPoller} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateDistributedAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, Context context); + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner createDistributedAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration); + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner createDistributedAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, + Context context); + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group 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 arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response addDatabasesWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases, Context context); + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group 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 arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner addDatabases(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Databases databases); + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group 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 arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response removeDatabasesWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases, Context context); + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group 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 arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner removeDatabases(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Databases databases); + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String sqlServerInstanceName); + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String sqlServerInstanceName, + Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerDatabasesClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerDatabasesClient.java new file mode 100644 index 000000000000..f6620f2bb3f0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerDatabasesClient.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.azurearcdata.fluent.models.SqlServerDatabaseResourceInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseUpdate; + +/** + * An instance of this class provides access to all the operations defined in SqlServerDatabasesClient. + */ +public interface SqlServerDatabasesClient { + /** + * Creates or replaces an Arc Sql Server Database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseResource The request body for database 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 arc Sql Server database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, String sqlServerInstanceName, + String databaseName, SqlServerDatabaseResourceInner sqlServerDatabaseResource, Context context); + + /** + * Creates or replaces an Arc Sql Server Database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseResource The request body for database 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 arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerDatabaseResourceInner create(String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseResourceInner sqlServerDatabaseResource); + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + String databaseName); + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + String databaseName, Context context); + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName); + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName, Context context); + + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String sqlServerInstanceName, + String databaseName, Context context); + + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerDatabaseResourceInner get(String resourceGroupName, String sqlServerInstanceName, String databaseName); + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerDatabaseResourceInner> beginUpdate( + String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseUpdate sqlServerDatabaseUpdate); + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerDatabaseResourceInner> beginUpdate( + String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseUpdate sqlServerDatabaseUpdate, Context context); + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerDatabaseResourceInner update(String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseUpdate sqlServerDatabaseUpdate); + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerDatabaseResourceInner update(String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseUpdate sqlServerDatabaseUpdate, Context context); + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String sqlServerInstanceName); + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String sqlServerInstanceName, + Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerEsuLicensesClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerEsuLicensesClient.java new file mode 100644 index 000000000000..171dd9512c75 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerEsuLicensesClient.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.azurearcdata.fluent.models.SqlServerEsuLicenseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdate; + +/** + * An instance of this class provides access to all the operations defined in SqlServerEsuLicensesClient. + */ +public interface SqlServerEsuLicensesClient { + /** + * List sqlServerEsuLicense resources in the 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 SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List sqlServerEsuLicense resources in the 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 SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses 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 all sqlServerEsuLicenses in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses 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 all sqlServerEsuLicenses in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerEsuLicenseName, Context context); + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerEsuLicenseInner getByResourceGroup(String resourceGroupName, String sqlServerEsuLicenseName); + + /** + * Creates or replaces a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param sqlServerEsuLicense The SQL Server ESU license to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, String sqlServerEsuLicenseName, + SqlServerEsuLicenseInner sqlServerEsuLicense, Context context); + + /** + * Creates or replaces a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param sqlServerEsuLicense The SQL Server ESU license to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerEsuLicenseInner create(String resourceGroupName, String sqlServerEsuLicenseName, + SqlServerEsuLicenseInner sqlServerEsuLicense); + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String sqlServerEsuLicenseName, Context context); + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 sqlServerEsuLicenseName); + + /** + * Updates a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param parameters The SQL Server ESU license. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String sqlServerEsuLicenseName, + SqlServerEsuLicenseUpdate parameters, Context context); + + /** + * Updates a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param parameters The SQL Server ESU license. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerEsuLicenseInner update(String resourceGroupName, String sqlServerEsuLicenseName, + SqlServerEsuLicenseUpdate parameters); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerInstancesClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerInstancesClient.java index 9bcffa5af944..ca4d4c4883ff 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerInstancesClient.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerInstancesClient.java @@ -12,13 +12,20 @@ import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsStatusResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryRequest; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceUpdate; +import java.util.List; -/** An instance of this class provides access to all the operations defined in SqlServerInstancesClient. */ +/** + * An instance of this class provides access to all the operations defined in SqlServerInstancesClient. + */ public interface SqlServerInstancesClient { /** * List sqlServerInstance resources in the 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 SqlServerInstance as paginated response with {@link PagedIterable}. @@ -28,7 +35,7 @@ public interface SqlServerInstancesClient { /** * List sqlServerInstance resources in the 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. @@ -40,9 +47,9 @@ public interface SqlServerInstancesClient { /** * List sqlServerInstance resources in the resource group - * - *

Gets all sqlServerInstances in a resource group. - * + * + * Gets all sqlServerInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -54,9 +61,9 @@ public interface SqlServerInstancesClient { /** * List sqlServerInstance resources in the resource group - * - *

Gets all sqlServerInstances in a resource group. - * + * + * Gets all sqlServerInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -69,7 +76,7 @@ public interface SqlServerInstancesClient { /** * Retrieves a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. @@ -79,12 +86,12 @@ public interface SqlServerInstancesClient { * @return a SqlServerInstance along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse( - String resourceGroupName, String sqlServerInstanceName, Context context); + Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerInstanceName, Context context); /** * Retrieves a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -97,9 +104,9 @@ Response getByResourceGroupWithResponse( /** * Creates or replaces a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param sqlServerInstance The SQL Server Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -107,14 +114,14 @@ Response getByResourceGroupWithResponse( * @return the {@link SyncPoller} for polling of a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, SqlServerInstanceInner> beginCreate( - String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance); + SyncPoller, SqlServerInstanceInner> beginCreate(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance); /** * Creates or replaces a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param sqlServerInstance The SQL Server Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -123,17 +130,14 @@ SyncPoller, SqlServerInstanceInner> beginCrea * @return the {@link SyncPoller} for polling of a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, SqlServerInstanceInner> beginCreate( - String resourceGroupName, - String sqlServerInstanceName, - SqlServerInstanceInner sqlServerInstance, - Context context); + SyncPoller, SqlServerInstanceInner> beginCreate(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance, Context context); /** * Creates or replaces a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param sqlServerInstance The SQL Server Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -141,14 +145,14 @@ SyncPoller, SqlServerInstanceInner> beginCrea * @return a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - SqlServerInstanceInner create( - String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance); + SqlServerInstanceInner create(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceInner sqlServerInstance); /** * Creates or replaces a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param sqlServerInstance The SQL Server Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -157,17 +161,14 @@ SqlServerInstanceInner create( * @return a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - SqlServerInstanceInner create( - String resourceGroupName, - String sqlServerInstanceName, - SqlServerInstanceInner sqlServerInstance, - Context context); + SqlServerInstanceInner create(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceInner sqlServerInstance, Context context); /** * Deletes a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -178,9 +179,9 @@ SqlServerInstanceInner create( /** * Deletes a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -188,14 +189,14 @@ SqlServerInstanceInner create( * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete( - String resourceGroupName, String sqlServerInstanceName, Context context); + SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + Context context); /** * Deletes a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -205,9 +206,9 @@ SyncPoller, Void> beginDelete( /** * Deletes a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -218,32 +219,211 @@ SyncPoller, Void> beginDelete( /** * Updates a SQL Server Instance resource. - * + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceInner> beginUpdate(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceUpdate parameters); + + /** + * Updates a SQL Server Instance resource. + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName Name of sqlServerInstance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param parameters The SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance along with {@link Response}. + * @return the {@link SyncPoller} for polling of a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceInner> beginUpdate(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceUpdate parameters, Context context); + + /** + * Updates a SQL Server Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse( - String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceUpdate parameters, Context context); + SqlServerInstanceInner update(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceUpdate parameters); /** * Updates a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName Name of sqlServerInstance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param parameters The SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceInner update(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceUpdate parameters, Context context); + + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a section of the telemetry response for the SQL Server instance as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable> getTelemetry(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest); + + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a section of the telemetry response for the SQL Server instance as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable> getTelemetry(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, Context context); + + /** + * Runs migration assessment for SQL Server instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response + runMigrationAssessmentWithResponse(String resourceGroupName, String sqlServerInstanceName, Context context); + + /** + * Runs migration assessment for SQL Server instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceRunMigrationAssessmentResponseInner runMigrationAssessment(String resourceGroupName, + String sqlServerInstanceName); + + /** + * Gets jobs status details for sql arc resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsStatusRequest Contains the parameters to get SQL Server instance agent jobs status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getJobsStatusWithResponse(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest, + Context context); + + /** + * Gets jobs status details for sql arc resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceJobsStatusResponseInner getJobsStatus(String resourceGroupName, String sqlServerInstanceName); + + /** + * Request Upgrade Permission before upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response preUpgradeWithResponse(String resourceGroupName, String sqlServerInstanceName, + Context context); + + /** + * Request Upgrade Permission before upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceInner preUpgrade(String resourceGroupName, String sqlServerInstanceName); + + /** + * Clean up after upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response postUpgradeWithResponse(String resourceGroupName, String sqlServerInstanceName, + Context context); + + /** + * Clean up after upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - SqlServerInstanceInner update( - String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceUpdate parameters); + SqlServerInstanceInner postUpgrade(String resourceGroupName, String sqlServerInstanceName); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerLicensesClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerLicensesClient.java new file mode 100644 index 000000000000..e7618e18c0d9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerLicensesClient.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.azurearcdata.fluent.models.SqlServerLicenseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseUpdate; + +/** + * An instance of this class provides access to all the operations defined in SqlServerLicensesClient. + */ +public interface SqlServerLicensesClient { + /** + * List sqlServerLicense resources in the 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 SQL Server licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List sqlServerLicense resources in the 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 SQL Server licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlServerLicenses in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlServerLicenses in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerLicenseName, Context context); + + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerLicenseInner getByResourceGroup(String resourceGroupName, String sqlServerLicenseName); + + /** + * Creates or replaces a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param sqlServerLicense The SQL Server license to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseInner sqlServerLicense, Context context); + + /** + * Creates or replaces a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param sqlServerLicense The SQL Server license to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerLicenseInner create(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseInner sqlServerLicense); + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String sqlServerLicenseName, Context context); + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 sqlServerLicenseName); + + /** + * Updates a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param parameters The SQL Server license. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseUpdate parameters, Context context); + + /** + * Updates a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param parameters The SQL Server license. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerLicenseInner update(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseUpdate parameters); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/ActiveDirectoryConnectorResourceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/ActiveDirectoryConnectorResourceInner.java new file mode 100644 index 000000000000..1a6f101d0dc5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/ActiveDirectoryConnectorResourceInner.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.azurearcdata.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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorProperties; +import java.io.IOException; + +/** + * Active directory connector resource. + */ +@Fluent +public final class ActiveDirectoryConnectorResourceInner extends ProxyResource { + /* + * null + */ + private ActiveDirectoryConnectorProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ActiveDirectoryConnectorResourceInner class. + */ + public ActiveDirectoryConnectorResourceInner() { + } + + /** + * Get the properties property: null. + * + * @return the properties value. + */ + public ActiveDirectoryConnectorProperties properties() { + return this.properties; + } + + /** + * Set the properties property: null. + * + * @param properties the properties value to set. + * @return the ActiveDirectoryConnectorResourceInner object itself. + */ + public ActiveDirectoryConnectorResourceInner withProperties(ActiveDirectoryConnectorProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property properties in model ActiveDirectoryConnectorResourceInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActiveDirectoryConnectorResourceInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryConnectorResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryConnectorResourceInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActiveDirectoryConnectorResourceInner. + */ + public static ActiveDirectoryConnectorResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryConnectorResourceInner deserializedActiveDirectoryConnectorResourceInner + = new ActiveDirectoryConnectorResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedActiveDirectoryConnectorResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedActiveDirectoryConnectorResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedActiveDirectoryConnectorResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedActiveDirectoryConnectorResourceInner.properties + = ActiveDirectoryConnectorProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedActiveDirectoryConnectorResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryConnectorResourceInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/DataControllerResourceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/DataControllerResourceInner.java index 67ab99fe1ccf..d9b1c1c85ce9 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/DataControllerResourceInner.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/DataControllerResourceInner.java @@ -8,39 +8,58 @@ import com.azure.core.management.Resource; import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.azurearcdata.models.DataControllerProperties; import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; -/** Data controller resource. */ +/** + * Data controller resource. + */ @Fluent public final class DataControllerResourceInner extends Resource { /* * The extendedLocation of the resource. */ - @JsonProperty(value = "extendedLocation") private ExtendedLocation extendedLocation; /* * The data controller's properties */ - @JsonProperty(value = "properties", required = true) private DataControllerProperties properties; /* - * Read only system data + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; - /** Creates an instance of DataControllerResourceInner class. */ + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of DataControllerResourceInner class. + */ public DataControllerResourceInner() { } /** * Get the extendedLocation property: The extendedLocation of the resource. - * + * * @return the extendedLocation value. */ public ExtendedLocation extendedLocation() { @@ -49,7 +68,7 @@ public ExtendedLocation extendedLocation() { /** * Set the extendedLocation property: The extendedLocation of the resource. - * + * * @param extendedLocation the extendedLocation value to set. * @return the DataControllerResourceInner object itself. */ @@ -60,7 +79,7 @@ public DataControllerResourceInner withExtendedLocation(ExtendedLocation extende /** * Get the properties property: The data controller's properties. - * + * * @return the properties value. */ public DataControllerProperties properties() { @@ -69,7 +88,7 @@ public DataControllerProperties properties() { /** * Set the properties property: The data controller's properties. - * + * * @param properties the properties value to set. * @return the DataControllerResourceInner object itself. */ @@ -79,22 +98,56 @@ public DataControllerResourceInner withProperties(DataControllerProperties prope } /** - * Get the systemData property: Read only system data. - * + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * * @return the systemData value. */ public SystemData systemData() { return this.systemData; } - /** {@inheritDoc} */ + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ @Override public DataControllerResourceInner withLocation(String location) { super.withLocation(location); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public DataControllerResourceInner withTags(Map tags) { super.withTags(tags); @@ -103,7 +156,7 @@ public DataControllerResourceInner withTags(Map tags) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -111,14 +164,68 @@ public void validate() { extendedLocation().validate(); } if (properties() == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - "Missing required property properties in model DataControllerResourceInner")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property properties in model DataControllerResourceInner")); } else { properties().validate(); } } private static final ClientLogger LOGGER = new ClientLogger(DataControllerResourceInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataControllerResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataControllerResourceInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DataControllerResourceInner. + */ + public static DataControllerResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataControllerResourceInner deserializedDataControllerResourceInner = new DataControllerResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDataControllerResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDataControllerResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDataControllerResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedDataControllerResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDataControllerResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedDataControllerResourceInner.properties = DataControllerProperties.fromJson(reader); + } else if ("extendedLocation".equals(fieldName)) { + deserializedDataControllerResourceInner.extendedLocation = ExtendedLocation.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedDataControllerResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDataControllerResourceInner; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/FailoverGroupResourceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/FailoverGroupResourceInner.java new file mode 100644 index 000000000000..914e0a157b01 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/FailoverGroupResourceInner.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupProperties; +import java.io.IOException; + +/** + * A failover group resource. + */ +@Fluent +public final class FailoverGroupResourceInner extends ProxyResource { + /* + * null + */ + private FailoverGroupProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of FailoverGroupResourceInner class. + */ + public FailoverGroupResourceInner() { + } + + /** + * Get the properties property: null. + * + * @return the properties value. + */ + public FailoverGroupProperties properties() { + return this.properties; + } + + /** + * Set the properties property: null. + * + * @param properties the properties value to set. + * @return the FailoverGroupResourceInner object itself. + */ + public FailoverGroupResourceInner withProperties(FailoverGroupProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property properties in model FailoverGroupResourceInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FailoverGroupResourceInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FailoverGroupResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FailoverGroupResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FailoverGroupResourceInner. + */ + public static FailoverGroupResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FailoverGroupResourceInner deserializedFailoverGroupResourceInner = new FailoverGroupResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFailoverGroupResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedFailoverGroupResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedFailoverGroupResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedFailoverGroupResourceInner.properties = FailoverGroupProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedFailoverGroupResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFailoverGroupResourceInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/OperationInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/OperationInner.java index 7671b9e3e146..112051d2868c 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/OperationInner.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/OperationInner.java @@ -6,53 +6,54 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.azurearcdata.models.OperationDisplay; import com.azure.resourcemanager.azurearcdata.models.OperationOrigin; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; -/** Azure Data Services on Azure Arc operation definition. */ +/** + * Azure Data Services on Azure Arc operation definition. + */ @Fluent -public final class OperationInner { +public final class OperationInner implements JsonSerializable { /* * The name of the operation being performed on this particular object. */ - @JsonProperty(value = "name", required = true) private String name; /* * The localized display information for this particular operation / action. */ - @JsonProperty(value = "display", required = true) private OperationDisplay display; /* * The intended executor of the operation. */ - @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) private OperationOrigin origin; /* * Indicates whether the operation is a data action */ - @JsonProperty(value = "isDataAction", required = true) private boolean isDataAction; /* * 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. */ + /** + * 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() { @@ -61,7 +62,7 @@ public String name() { /** * Set the name property: The name of the operation being performed on this particular object. - * + * * @param name the name value to set. * @return the OperationInner object itself. */ @@ -72,7 +73,7 @@ public OperationInner withName(String name) { /** * Get the display property: The localized display information for this particular operation / action. - * + * * @return the display value. */ public OperationDisplay display() { @@ -81,7 +82,7 @@ public OperationDisplay display() { /** * Set the display property: The localized display information for this particular operation / action. - * + * * @param display the display value to set. * @return the OperationInner object itself. */ @@ -92,7 +93,7 @@ public OperationInner withDisplay(OperationDisplay display) { /** * Get the origin property: The intended executor of the operation. - * + * * @return the origin value. */ public OperationOrigin origin() { @@ -101,7 +102,7 @@ public OperationOrigin origin() { /** * Get the isDataAction property: Indicates whether the operation is a data action. - * + * * @return the isDataAction value. */ public boolean isDataAction() { @@ -110,7 +111,7 @@ public boolean 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. */ @@ -121,7 +122,7 @@ public OperationInner withIsDataAction(boolean isDataAction) { /** * Get the properties property: Additional descriptions for the operation. - * + * * @return the properties value. */ public Map properties() { @@ -130,23 +131,69 @@ public Map properties() { /** * 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 OperationInner")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model OperationInner")); } if (display() == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException("Missing required property display in model OperationInner")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property display in model OperationInner")); } else { display().validate(); } } private static final ClientLogger LOGGER = new ClientLogger(OperationInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("display", this.display); + jsonWriter.writeBooleanField("isDataAction", this.isDataAction); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getBoolean(); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = OperationOrigin.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + Map properties = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedOperationInner.properties = properties; + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/PostgresInstanceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/PostgresInstanceInner.java new file mode 100644 index 000000000000..42ae5a112b6c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/PostgresInstanceInner.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceProperties; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSku; +import java.io.IOException; +import java.util.Map; + +/** + * A Postgres Instance. + */ +@Fluent +public final class PostgresInstanceInner extends Resource { + /* + * The extendedLocation of the resource. + */ + private ExtendedLocation extendedLocation; + + /* + * null + */ + private PostgresInstanceProperties properties; + + /* + * Resource sku. + */ + private PostgresInstanceSku sku; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of PostgresInstanceInner class. + */ + public PostgresInstanceInner() { + } + + /** + * Get the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extendedLocation of the resource. + * + * @param extendedLocation the extendedLocation value to set. + * @return the PostgresInstanceInner object itself. + */ + public PostgresInstanceInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** + * Get the properties property: null. + * + * @return the properties value. + */ + public PostgresInstanceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: null. + * + * @param properties the properties value to set. + * @return the PostgresInstanceInner object itself. + */ + public PostgresInstanceInner withProperties(PostgresInstanceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the sku property: Resource sku. + * + * @return the sku value. + */ + public PostgresInstanceSku sku() { + return this.sku; + } + + /** + * Set the sku property: Resource sku. + * + * @param sku the sku value to set. + * @return the PostgresInstanceInner object itself. + */ + public PostgresInstanceInner withSku(PostgresInstanceSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public PostgresInstanceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PostgresInstanceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (extendedLocation() != null) { + extendedLocation().validate(); + } + if (properties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property properties in model PostgresInstanceInner")); + } else { + properties().validate(); + } + if (sku() != null) { + sku().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PostgresInstanceInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + jsonWriter.writeJsonField("sku", this.sku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PostgresInstanceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PostgresInstanceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PostgresInstanceInner. + */ + public static PostgresInstanceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PostgresInstanceInner deserializedPostgresInstanceInner = new PostgresInstanceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPostgresInstanceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPostgresInstanceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPostgresInstanceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedPostgresInstanceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPostgresInstanceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedPostgresInstanceInner.properties = PostgresInstanceProperties.fromJson(reader); + } else if ("extendedLocation".equals(fieldName)) { + deserializedPostgresInstanceInner.extendedLocation = ExtendedLocation.fromJson(reader); + } else if ("sku".equals(fieldName)) { + deserializedPostgresInstanceInner.sku = PostgresInstanceSku.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPostgresInstanceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPostgresInstanceInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlManagedInstanceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlManagedInstanceInner.java index 2c0b2e1ebe67..e31b58227aa6 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlManagedInstanceInner.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlManagedInstanceInner.java @@ -8,46 +8,64 @@ import com.azure.core.management.Resource; import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceProperties; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceSku; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; -/** A SqlManagedInstance. */ +/** + * A SqlManagedInstance. + */ @Fluent public final class SqlManagedInstanceInner extends Resource { /* * null */ - @JsonProperty(value = "properties", required = true) private SqlManagedInstanceProperties properties; /* * The extendedLocation of the resource. */ - @JsonProperty(value = "extendedLocation") private ExtendedLocation extendedLocation; /* * Resource sku. */ - @JsonProperty(value = "sku") private SqlManagedInstanceSku sku; /* - * Read only system data + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; - /** Creates an instance of SqlManagedInstanceInner class. */ + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlManagedInstanceInner class. + */ public SqlManagedInstanceInner() { } /** * Get the properties property: null. - * + * * @return the properties value. */ public SqlManagedInstanceProperties properties() { @@ -56,7 +74,7 @@ public SqlManagedInstanceProperties properties() { /** * Set the properties property: null. - * + * * @param properties the properties value to set. * @return the SqlManagedInstanceInner object itself. */ @@ -67,7 +85,7 @@ public SqlManagedInstanceInner withProperties(SqlManagedInstanceProperties prope /** * Get the extendedLocation property: The extendedLocation of the resource. - * + * * @return the extendedLocation value. */ public ExtendedLocation extendedLocation() { @@ -76,7 +94,7 @@ public ExtendedLocation extendedLocation() { /** * Set the extendedLocation property: The extendedLocation of the resource. - * + * * @param extendedLocation the extendedLocation value to set. * @return the SqlManagedInstanceInner object itself. */ @@ -87,7 +105,7 @@ public SqlManagedInstanceInner withExtendedLocation(ExtendedLocation extendedLoc /** * Get the sku property: Resource sku. - * + * * @return the sku value. */ public SqlManagedInstanceSku sku() { @@ -96,7 +114,7 @@ public SqlManagedInstanceSku sku() { /** * Set the sku property: Resource sku. - * + * * @param sku the sku value to set. * @return the SqlManagedInstanceInner object itself. */ @@ -106,22 +124,56 @@ public SqlManagedInstanceInner withSku(SqlManagedInstanceSku sku) { } /** - * Get the systemData property: Read only system data. - * + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * * @return the systemData value. */ public SystemData systemData() { return this.systemData; } - /** {@inheritDoc} */ + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ @Override public SqlManagedInstanceInner withLocation(String location) { super.withLocation(location); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public SqlManagedInstanceInner withTags(Map tags) { super.withTags(tags); @@ -130,15 +182,14 @@ public SqlManagedInstanceInner withTags(Map tags) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (properties() == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - "Missing required property properties in model SqlManagedInstanceInner")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property properties in model SqlManagedInstanceInner")); } else { properties().validate(); } @@ -151,4 +202,62 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(SqlManagedInstanceInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + jsonWriter.writeJsonField("sku", this.sku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlManagedInstanceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlManagedInstanceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlManagedInstanceInner. + */ + public static SqlManagedInstanceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlManagedInstanceInner deserializedSqlManagedInstanceInner = new SqlManagedInstanceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlManagedInstanceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlManagedInstanceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlManagedInstanceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlManagedInstanceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlManagedInstanceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlManagedInstanceInner.properties = SqlManagedInstanceProperties.fromJson(reader); + } else if ("extendedLocation".equals(fieldName)) { + deserializedSqlManagedInstanceInner.extendedLocation = ExtendedLocation.fromJson(reader); + } else if ("sku".equals(fieldName)) { + deserializedSqlManagedInstanceInner.sku = SqlManagedInstanceSku.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSqlManagedInstanceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlManagedInstanceInner; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerAvailabilityGroupResourceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerAvailabilityGroupResourceInner.java new file mode 100644 index 000000000000..1c5dce6e8e0a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerAvailabilityGroupResourceInner.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourceProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Arc Sql Server Availability Group. + */ +@Fluent +public final class SqlServerAvailabilityGroupResourceInner extends Resource { + /* + * Properties of Arc Sql Server availability group + */ + private SqlServerAvailabilityGroupResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlServerAvailabilityGroupResourceInner class. + */ + public SqlServerAvailabilityGroupResourceInner() { + } + + /** + * Get the properties property: Properties of Arc Sql Server availability group. + * + * @return the properties value. + */ + public SqlServerAvailabilityGroupResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of Arc Sql Server availability group. + * + * @param properties the properties value to set. + * @return the SqlServerAvailabilityGroupResourceInner object itself. + */ + public SqlServerAvailabilityGroupResourceInner + withProperties(SqlServerAvailabilityGroupResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlServerAvailabilityGroupResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlServerAvailabilityGroupResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property properties in model SqlServerAvailabilityGroupResourceInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlServerAvailabilityGroupResourceInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerAvailabilityGroupResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerAvailabilityGroupResourceInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerAvailabilityGroupResourceInner. + */ + public static SqlServerAvailabilityGroupResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerAvailabilityGroupResourceInner deserializedSqlServerAvailabilityGroupResourceInner + = new SqlServerAvailabilityGroupResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerAvailabilityGroupResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceInner.properties + = SqlServerAvailabilityGroupResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerAvailabilityGroupResourceInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerDatabaseResourceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerDatabaseResourceInner.java new file mode 100644 index 000000000000..cfb064e587dd --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerDatabaseResourceInner.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourceProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Arc Sql Server database. + */ +@Fluent +public final class SqlServerDatabaseResourceInner extends Resource { + /* + * Properties of Arc Sql Server database + */ + private SqlServerDatabaseResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlServerDatabaseResourceInner class. + */ + public SqlServerDatabaseResourceInner() { + } + + /** + * Get the properties property: Properties of Arc Sql Server database. + * + * @return the properties value. + */ + public SqlServerDatabaseResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of Arc Sql Server database. + * + * @param properties the properties value to set. + * @return the SqlServerDatabaseResourceInner object itself. + */ + public SqlServerDatabaseResourceInner withProperties(SqlServerDatabaseResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlServerDatabaseResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlServerDatabaseResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property properties in model SqlServerDatabaseResourceInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlServerDatabaseResourceInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerDatabaseResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerDatabaseResourceInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerDatabaseResourceInner. + */ + public static SqlServerDatabaseResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerDatabaseResourceInner deserializedSqlServerDatabaseResourceInner + = new SqlServerDatabaseResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlServerDatabaseResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlServerDatabaseResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlServerDatabaseResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlServerDatabaseResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerDatabaseResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlServerDatabaseResourceInner.properties + = SqlServerDatabaseResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSqlServerDatabaseResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerDatabaseResourceInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerEsuLicenseInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerEsuLicenseInner.java new file mode 100644 index 000000000000..9782ce28c86a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerEsuLicenseInner.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Describe SQL Server ESU license resource. + */ +@Fluent +public final class SqlServerEsuLicenseInner extends Resource { + /* + * SQL Server ESU license properties + */ + private SqlServerEsuLicenseProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlServerEsuLicenseInner class. + */ + public SqlServerEsuLicenseInner() { + } + + /** + * Get the properties property: SQL Server ESU license properties. + * + * @return the properties value. + */ + public SqlServerEsuLicenseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: SQL Server ESU license properties. + * + * @param properties the properties value to set. + * @return the SqlServerEsuLicenseInner object itself. + */ + public SqlServerEsuLicenseInner withProperties(SqlServerEsuLicenseProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlServerEsuLicenseInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlServerEsuLicenseInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property properties in model SqlServerEsuLicenseInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlServerEsuLicenseInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerEsuLicenseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerEsuLicenseInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerEsuLicenseInner. + */ + public static SqlServerEsuLicenseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerEsuLicenseInner deserializedSqlServerEsuLicenseInner = new SqlServerEsuLicenseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlServerEsuLicenseInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlServerEsuLicenseInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlServerEsuLicenseInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlServerEsuLicenseInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerEsuLicenseInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlServerEsuLicenseInner.properties = SqlServerEsuLicenseProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSqlServerEsuLicenseInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerEsuLicenseInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceInner.java index ae6e655f4171..32896d7c10b4 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceInner.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceInner.java @@ -7,32 +7,52 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; -/** A SqlServerInstance. */ +/** + * A SqlServerInstance. + */ @Fluent public final class SqlServerInstanceInner extends Resource { /* * null */ - @JsonProperty(value = "properties") private SqlServerInstanceProperties properties; /* - * Read only system data + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; - /** Creates an instance of SqlServerInstanceInner class. */ + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlServerInstanceInner class. + */ public SqlServerInstanceInner() { } /** * Get the properties property: null. - * + * * @return the properties value. */ public SqlServerInstanceProperties properties() { @@ -41,7 +61,7 @@ public SqlServerInstanceProperties properties() { /** * Set the properties property: null. - * + * * @param properties the properties value to set. * @return the SqlServerInstanceInner object itself. */ @@ -51,22 +71,56 @@ public SqlServerInstanceInner withProperties(SqlServerInstanceProperties propert } /** - * Get the systemData property: Read only system data. - * + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * * @return the systemData value. */ public SystemData systemData() { return this.systemData; } - /** {@inheritDoc} */ + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ @Override public SqlServerInstanceInner withLocation(String location) { super.withLocation(location); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public SqlServerInstanceInner withTags(Map tags) { super.withTags(tags); @@ -75,7 +129,7 @@ public SqlServerInstanceInner withTags(Map tags) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -83,4 +137,56 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerInstanceInner. + */ + public static SqlServerInstanceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceInner deserializedSqlServerInstanceInner = new SqlServerInstanceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlServerInstanceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlServerInstanceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlServerInstanceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlServerInstanceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerInstanceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlServerInstanceInner.properties = SqlServerInstanceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSqlServerInstanceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceInner; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceJobsStatusResponseInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceJobsStatusResponseInner.java new file mode 100644 index 000000000000..e116dc3d1146 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceJobsStatusResponseInner.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.azurearcdata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobStatus; +import java.io.IOException; +import java.util.List; + +/** + * The response for the status of the jobs running on the SQL Server instance. + */ +@Fluent +public final class SqlServerInstanceJobsStatusResponseInner + implements JsonSerializable { + /* + * The list of jobs status running on the SQL Server instance. + */ + private List jobsStatus; + + /** + * Creates an instance of SqlServerInstanceJobsStatusResponseInner class. + */ + public SqlServerInstanceJobsStatusResponseInner() { + } + + /** + * Get the jobsStatus property: The list of jobs status running on the SQL Server instance. + * + * @return the jobsStatus value. + */ + public List jobsStatus() { + return this.jobsStatus; + } + + /** + * Set the jobsStatus property: The list of jobs status running on the SQL Server instance. + * + * @param jobsStatus the jobsStatus value to set. + * @return the SqlServerInstanceJobsStatusResponseInner object itself. + */ + public SqlServerInstanceJobsStatusResponseInner withJobsStatus(List jobsStatus) { + this.jobsStatus = jobsStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (jobsStatus() != null) { + jobsStatus().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("jobsStatus", this.jobsStatus, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceJobsStatusResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceJobsStatusResponseInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceJobsStatusResponseInner. + */ + public static SqlServerInstanceJobsStatusResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceJobsStatusResponseInner deserializedSqlServerInstanceJobsStatusResponseInner + = new SqlServerInstanceJobsStatusResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("jobsStatus".equals(fieldName)) { + List jobsStatus + = reader.readArray(reader1 -> SqlServerInstanceJobStatus.fromJson(reader1)); + deserializedSqlServerInstanceJobsStatusResponseInner.jobsStatus = jobsStatus; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceJobsStatusResponseInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunMigrationAssessmentResponseInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunMigrationAssessmentResponseInner.java new file mode 100644 index 000000000000..c3c19a5a40ab --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunMigrationAssessmentResponseInner.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.BackgroundJob; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.SequencerAction; +import java.io.IOException; +import java.util.List; + +/** + * The response for running migration assessment on the SQL Server instance. + */ +@Fluent +public final class SqlServerInstanceRunMigrationAssessmentResponseInner + implements JsonSerializable { + /* + * The unique identifier of the job. + */ + private String id; + + /* + * The name of the SQL Server instance. + */ + private String instanceName; + + /* + * The status of the job. + */ + private JobStatus jobStatus; + + /* + * The exception message if the job failed. + */ + private String jobException; + + /* + * The background job details. + */ + private BackgroundJob backgroundJob; + + /* + * The list of sequencer actions. + */ + private List sequencerActions; + + /** + * Creates an instance of SqlServerInstanceRunMigrationAssessmentResponseInner class. + */ + public SqlServerInstanceRunMigrationAssessmentResponseInner() { + } + + /** + * Get the id property: The unique identifier of the job. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The unique identifier of the job. + * + * @param id the id value to set. + * @return the SqlServerInstanceRunMigrationAssessmentResponseInner object itself. + */ + public SqlServerInstanceRunMigrationAssessmentResponseInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the instanceName property: The name of the SQL Server instance. + * + * @return the instanceName value. + */ + public String instanceName() { + return this.instanceName; + } + + /** + * Set the instanceName property: The name of the SQL Server instance. + * + * @param instanceName the instanceName value to set. + * @return the SqlServerInstanceRunMigrationAssessmentResponseInner object itself. + */ + public SqlServerInstanceRunMigrationAssessmentResponseInner withInstanceName(String instanceName) { + this.instanceName = instanceName; + return this; + } + + /** + * Get the jobStatus property: The status of the job. + * + * @return the jobStatus value. + */ + public JobStatus jobStatus() { + return this.jobStatus; + } + + /** + * Set the jobStatus property: The status of the job. + * + * @param jobStatus the jobStatus value to set. + * @return the SqlServerInstanceRunMigrationAssessmentResponseInner object itself. + */ + public SqlServerInstanceRunMigrationAssessmentResponseInner withJobStatus(JobStatus jobStatus) { + this.jobStatus = jobStatus; + return this; + } + + /** + * Get the jobException property: The exception message if the job failed. + * + * @return the jobException value. + */ + public String jobException() { + return this.jobException; + } + + /** + * Set the jobException property: The exception message if the job failed. + * + * @param jobException the jobException value to set. + * @return the SqlServerInstanceRunMigrationAssessmentResponseInner object itself. + */ + public SqlServerInstanceRunMigrationAssessmentResponseInner withJobException(String jobException) { + this.jobException = jobException; + return this; + } + + /** + * Get the backgroundJob property: The background job details. + * + * @return the backgroundJob value. + */ + public BackgroundJob backgroundJob() { + return this.backgroundJob; + } + + /** + * Set the backgroundJob property: The background job details. + * + * @param backgroundJob the backgroundJob value to set. + * @return the SqlServerInstanceRunMigrationAssessmentResponseInner object itself. + */ + public SqlServerInstanceRunMigrationAssessmentResponseInner withBackgroundJob(BackgroundJob backgroundJob) { + this.backgroundJob = backgroundJob; + return this; + } + + /** + * Get the sequencerActions property: The list of sequencer actions. + * + * @return the sequencerActions value. + */ + public List sequencerActions() { + return this.sequencerActions; + } + + /** + * Set the sequencerActions property: The list of sequencer actions. + * + * @param sequencerActions the sequencerActions value to set. + * @return the SqlServerInstanceRunMigrationAssessmentResponseInner object itself. + */ + public SqlServerInstanceRunMigrationAssessmentResponseInner + withSequencerActions(List sequencerActions) { + this.sequencerActions = sequencerActions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (backgroundJob() != null) { + backgroundJob().validate(); + } + if (sequencerActions() != null) { + sequencerActions().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("instanceName", this.instanceName); + jsonWriter.writeStringField("jobStatus", this.jobStatus == null ? null : this.jobStatus.toString()); + jsonWriter.writeStringField("jobException", this.jobException); + jsonWriter.writeJsonField("backgroundJob", this.backgroundJob); + jsonWriter.writeArrayField("sequencerActions", this.sequencerActions, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceRunMigrationAssessmentResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceRunMigrationAssessmentResponseInner if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceRunMigrationAssessmentResponseInner. + */ + public static SqlServerInstanceRunMigrationAssessmentResponseInner fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceRunMigrationAssessmentResponseInner deserializedSqlServerInstanceRunMigrationAssessmentResponseInner + = new SqlServerInstanceRunMigrationAssessmentResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlServerInstanceRunMigrationAssessmentResponseInner.id = reader.getString(); + } else if ("instanceName".equals(fieldName)) { + deserializedSqlServerInstanceRunMigrationAssessmentResponseInner.instanceName = reader.getString(); + } else if ("jobStatus".equals(fieldName)) { + deserializedSqlServerInstanceRunMigrationAssessmentResponseInner.jobStatus + = JobStatus.fromString(reader.getString()); + } else if ("jobException".equals(fieldName)) { + deserializedSqlServerInstanceRunMigrationAssessmentResponseInner.jobException = reader.getString(); + } else if ("backgroundJob".equals(fieldName)) { + deserializedSqlServerInstanceRunMigrationAssessmentResponseInner.backgroundJob + = BackgroundJob.fromJson(reader); + } else if ("sequencerActions".equals(fieldName)) { + List sequencerActions + = reader.readArray(reader1 -> SequencerAction.fromJson(reader1)); + deserializedSqlServerInstanceRunMigrationAssessmentResponseInner.sequencerActions + = sequencerActions; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceRunMigrationAssessmentResponseInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerLicenseInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerLicenseInner.java new file mode 100644 index 000000000000..6b14562f4e66 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerLicenseInner.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Describe SQL Server license resource. + */ +@Fluent +public final class SqlServerLicenseInner extends Resource { + /* + * SQL Server license properties + */ + private SqlServerLicenseProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlServerLicenseInner class. + */ + public SqlServerLicenseInner() { + } + + /** + * Get the properties property: SQL Server license properties. + * + * @return the properties value. + */ + public SqlServerLicenseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: SQL Server license properties. + * + * @param properties the properties value to set. + * @return the SqlServerLicenseInner object itself. + */ + public SqlServerLicenseInner withProperties(SqlServerLicenseProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlServerLicenseInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlServerLicenseInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property properties in model SqlServerLicenseInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlServerLicenseInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerLicenseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerLicenseInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerLicenseInner. + */ + public static SqlServerLicenseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerLicenseInner deserializedSqlServerLicenseInner = new SqlServerLicenseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlServerLicenseInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlServerLicenseInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlServerLicenseInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlServerLicenseInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerLicenseInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlServerLicenseInner.properties = SqlServerLicenseProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSqlServerLicenseInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerLicenseInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/package-info.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/package-info.java index 91a1d2c9554d..2e89ec87247b 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/package-info.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/package-info.java @@ -3,7 +3,8 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * Package containing the inner data models for AzureArcDataManagementClient. The AzureArcData management API provides a - * RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. + * Package containing the inner data models for AzureArcDataManagementClient. + * The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc + * Resources. */ package com.azure.resourcemanager.azurearcdata.fluent.models; diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/package-info.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/package-info.java index 904a73cdcffe..da1de4780bf6 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/package-info.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/package-info.java @@ -3,7 +3,8 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * Package containing the service clients for AzureArcDataManagementClient. The AzureArcData management API provides a - * RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. + * Package containing the service clients for AzureArcDataManagementClient. + * The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc + * Resources. */ package com.azure.resourcemanager.azurearcdata.fluent; diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorResourceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorResourceImpl.java new file mode 100644 index 000000000000..7c769214eaf3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorResourceImpl.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.ActiveDirectoryConnectorResourceInner; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorProperties; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorResource; + +public final class ActiveDirectoryConnectorResourceImpl + implements ActiveDirectoryConnectorResource, ActiveDirectoryConnectorResource.Definition { + private ActiveDirectoryConnectorResourceInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + ActiveDirectoryConnectorResourceImpl(ActiveDirectoryConnectorResourceInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager 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 ActiveDirectoryConnectorProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ActiveDirectoryConnectorResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String dataControllerName; + + private String activeDirectoryConnectorName; + + public ActiveDirectoryConnectorResourceImpl withExistingDataController(String resourceGroupName, + String dataControllerName) { + this.resourceGroupName = resourceGroupName; + this.dataControllerName = dataControllerName; + return this; + } + + public ActiveDirectoryConnectorResource create() { + this.innerObject = serviceManager.serviceClient() + .getActiveDirectoryConnectors() + .create(resourceGroupName, dataControllerName, activeDirectoryConnectorName, this.innerModel(), + Context.NONE); + return this; + } + + public ActiveDirectoryConnectorResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getActiveDirectoryConnectors() + .create(resourceGroupName, dataControllerName, activeDirectoryConnectorName, this.innerModel(), context); + return this; + } + + ActiveDirectoryConnectorResourceImpl(String name, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new ActiveDirectoryConnectorResourceInner(); + this.serviceManager = serviceManager; + this.activeDirectoryConnectorName = name; + } + + public ActiveDirectoryConnectorResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getActiveDirectoryConnectors() + .getWithResponse(resourceGroupName, dataControllerName, activeDirectoryConnectorName, Context.NONE) + .getValue(); + return this; + } + + public ActiveDirectoryConnectorResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getActiveDirectoryConnectors() + .getWithResponse(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context) + .getValue(); + return this; + } + + public ActiveDirectoryConnectorResourceImpl withProperties(ActiveDirectoryConnectorProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsClientImpl.java new file mode 100644 index 000000000000..e04321466427 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsClientImpl.java @@ -0,0 +1,969 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.azurearcdata.fluent.ActiveDirectoryConnectorsClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.ActiveDirectoryConnectorResourceInner; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorListResult; +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 ActiveDirectoryConnectorsClient. + */ +public final class ActiveDirectoryConnectorsClientImpl implements ActiveDirectoryConnectorsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ActiveDirectoryConnectorsService service; + + /** + * The service client containing this operation class. + */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of ActiveDirectoryConnectorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ActiveDirectoryConnectorsClientImpl(AzureArcDataManagementClientImpl client) { + this.service = RestProxy.create(ActiveDirectoryConnectorsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientActiveDirectoryConnectors to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureArcDataManageme") + public interface ActiveDirectoryConnectorsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, + @PathParam("activeDirectoryConnectorName") String activeDirectoryConnectorName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, + @PathParam("activeDirectoryConnectorName") String activeDirectoryConnectorName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, + @PathParam("activeDirectoryConnectorName") String activeDirectoryConnectorName, + @QueryParam("api-version") String apiVersion, @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); + } + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String dataControllerName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (dataControllerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, dataControllerName, this.client.getApiVersion(), 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 the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String dataControllerName, 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 (dataControllerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, dataControllerName, + this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, + String dataControllerName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, dataControllerName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, + String dataControllerName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, dataControllerName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, + String dataControllerName) { + return new PagedIterable<>(listAsync(resourceGroupName, dataControllerName)); + } + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, + String dataControllerName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, dataControllerName, context)); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, + String dataControllerName, String activeDirectoryConnectorName, + ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (dataControllerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); + } + if (activeDirectoryConnectorName == null) { + return Mono.error( + new IllegalArgumentException("Parameter activeDirectoryConnectorName is required and cannot be null.")); + } + if (activeDirectoryConnectorResource == null) { + return Mono.error(new IllegalArgumentException( + "Parameter activeDirectoryConnectorResource is required and cannot be null.")); + } else { + activeDirectoryConnectorResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, dataControllerName, activeDirectoryConnectorName, this.client.getApiVersion(), + activeDirectoryConnectorResource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, + String dataControllerName, String activeDirectoryConnectorName, + ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource, 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 (dataControllerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); + } + if (activeDirectoryConnectorName == null) { + return Mono.error( + new IllegalArgumentException("Parameter activeDirectoryConnectorName is required and cannot be null.")); + } + if (activeDirectoryConnectorResource == null) { + return Mono.error(new IllegalArgumentException( + "Parameter activeDirectoryConnectorResource is required and cannot be null.")); + } else { + activeDirectoryConnectorResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + dataControllerName, activeDirectoryConnectorName, this.client.getApiVersion(), + activeDirectoryConnectorResource, accept, context); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ActiveDirectoryConnectorResourceInner> + beginCreateAsync(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName, + ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource) { + Mono>> mono = createWithResponseAsync(resourceGroupName, dataControllerName, + activeDirectoryConnectorName, activeDirectoryConnectorResource); + return this.client.getLroResult( + mono, this.client.getHttpPipeline(), ActiveDirectoryConnectorResourceInner.class, + ActiveDirectoryConnectorResourceInner.class, this.client.getContext()); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ActiveDirectoryConnectorResourceInner> + beginCreateAsync(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName, + ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createWithResponseAsync(resourceGroupName, dataControllerName, + activeDirectoryConnectorName, activeDirectoryConnectorResource, context); + return this.client.getLroResult( + mono, this.client.getHttpPipeline(), ActiveDirectoryConnectorResourceInner.class, + ActiveDirectoryConnectorResourceInner.class, context); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ActiveDirectoryConnectorResourceInner> + beginCreate(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName, + ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource) { + return this + .beginCreateAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, + activeDirectoryConnectorResource) + .getSyncPoller(); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ActiveDirectoryConnectorResourceInner> + beginCreate(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName, + ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource, Context context) { + return this + .beginCreateAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, + activeDirectoryConnectorResource, context) + .getSyncPoller(); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource) { + return beginCreateAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, + activeDirectoryConnectorResource).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource, + Context context) { + return beginCreateAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, + activeDirectoryConnectorResource, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActiveDirectoryConnectorResourceInner create(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource) { + return createAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, + activeDirectoryConnectorResource).block(); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActiveDirectoryConnectorResourceInner create(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource, + Context context) { + return createAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, + activeDirectoryConnectorResource, context).block(); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 dataControllerName, String activeDirectoryConnectorName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (dataControllerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); + } + if (activeDirectoryConnectorName == null) { + return Mono.error( + new IllegalArgumentException("Parameter activeDirectoryConnectorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + dataControllerName, activeDirectoryConnectorName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 dataControllerName, String activeDirectoryConnectorName, 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 (dataControllerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); + } + if (activeDirectoryConnectorName == null) { + return Mono.error( + new IllegalArgumentException("Parameter activeDirectoryConnectorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + dataControllerName, activeDirectoryConnectorName, this.client.getApiVersion(), accept, context); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 dataControllerName, + String activeDirectoryConnectorName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 dataControllerName, + String activeDirectoryConnectorName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 dataControllerName, + String activeDirectoryConnectorName) { + return this.beginDeleteAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName) + .getSyncPoller(); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 dataControllerName, + String activeDirectoryConnectorName, Context context) { + return this.beginDeleteAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context) + .getSyncPoller(); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 dataControllerName, + String activeDirectoryConnectorName) { + return beginDeleteAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 dataControllerName, + String activeDirectoryConnectorName, Context context) { + return beginDeleteAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 dataControllerName, String activeDirectoryConnectorName) { + deleteAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName).block(); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 dataControllerName, String activeDirectoryConnectorName, + Context context) { + deleteAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context).block(); + } + + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String dataControllerName, String activeDirectoryConnectorName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (dataControllerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); + } + if (activeDirectoryConnectorName == null) { + return Mono.error( + new IllegalArgumentException("Parameter activeDirectoryConnectorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + dataControllerName, activeDirectoryConnectorName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String dataControllerName, String activeDirectoryConnectorName, 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 (dataControllerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); + } + if (activeDirectoryConnectorName == null) { + return Mono.error( + new IllegalArgumentException("Parameter activeDirectoryConnectorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + dataControllerName, activeDirectoryConnectorName, this.client.getApiVersion(), accept, context); + } + + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName) { + return getWithResponseAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String dataControllerName, String activeDirectoryConnectorName, Context context) { + return getWithResponseAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context) + .block(); + } + + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActiveDirectoryConnectorResourceInner get(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName) { + return getWithResponse(resourceGroupName, dataControllerName, activeDirectoryConnectorName, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsImpl.java new file mode 100644 index 000000000000..8e7dfadb9bdb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.azurearcdata.fluent.ActiveDirectoryConnectorsClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.ActiveDirectoryConnectorResourceInner; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorResource; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectors; + +public final class ActiveDirectoryConnectorsImpl implements ActiveDirectoryConnectors { + private static final ClientLogger LOGGER = new ClientLogger(ActiveDirectoryConnectorsImpl.class); + + private final ActiveDirectoryConnectorsClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public ActiveDirectoryConnectorsImpl(ActiveDirectoryConnectorsClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String dataControllerName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, dataControllerName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new ActiveDirectoryConnectorResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String dataControllerName, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, dataControllerName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new ActiveDirectoryConnectorResourceImpl(inner1, this.manager())); + } + + public void delete(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName) { + this.serviceClient().delete(resourceGroupName, dataControllerName, activeDirectoryConnectorName); + } + + public void delete(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName, + Context context) { + this.serviceClient().delete(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context); + } + + public Response getWithResponse(String resourceGroupName, + String dataControllerName, String activeDirectoryConnectorName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ActiveDirectoryConnectorResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ActiveDirectoryConnectorResource get(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName) { + ActiveDirectoryConnectorResourceInner inner + = this.serviceClient().get(resourceGroupName, dataControllerName, activeDirectoryConnectorName); + if (inner != null) { + return new ActiveDirectoryConnectorResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public ActiveDirectoryConnectorResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 dataControllerName = ResourceManagerUtils.getValueFromIdByName(id, "dataControllers"); + if (dataControllerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataControllers'.", id))); + } + String activeDirectoryConnectorName + = ResourceManagerUtils.getValueFromIdByName(id, "activeDirectoryConnectors"); + if (activeDirectoryConnectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'activeDirectoryConnectors'.", id))); + } + return this.getWithResponse(resourceGroupName, dataControllerName, activeDirectoryConnectorName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 dataControllerName = ResourceManagerUtils.getValueFromIdByName(id, "dataControllers"); + if (dataControllerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataControllers'.", id))); + } + String activeDirectoryConnectorName + = ResourceManagerUtils.getValueFromIdByName(id, "activeDirectoryConnectors"); + if (activeDirectoryConnectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'activeDirectoryConnectors'.", id))); + } + return this.getWithResponse(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.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 dataControllerName = ResourceManagerUtils.getValueFromIdByName(id, "dataControllers"); + if (dataControllerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataControllers'.", id))); + } + String activeDirectoryConnectorName + = ResourceManagerUtils.getValueFromIdByName(id, "activeDirectoryConnectors"); + if (activeDirectoryConnectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'activeDirectoryConnectors'.", id))); + } + this.delete(resourceGroupName, dataControllerName, activeDirectoryConnectorName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 dataControllerName = ResourceManagerUtils.getValueFromIdByName(id, "dataControllers"); + if (dataControllerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataControllers'.", id))); + } + String activeDirectoryConnectorName + = ResourceManagerUtils.getValueFromIdByName(id, "activeDirectoryConnectors"); + if (activeDirectoryConnectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'activeDirectoryConnectors'.", id))); + } + this.delete(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context); + } + + private ActiveDirectoryConnectorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public ActiveDirectoryConnectorResourceImpl define(String name) { + return new ActiveDirectoryConnectorResourceImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientBuilder.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientBuilder.java index e3b215d7bf7c..cd4bf41f0178 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientBuilder.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientBuilder.java @@ -14,8 +14,10 @@ import com.azure.core.util.serializer.SerializerAdapter; import java.time.Duration; -/** A builder for creating a new instance of the AzureArcDataManagementClientImpl type. */ -@ServiceClientBuilder(serviceClients = {AzureArcDataManagementClientImpl.class}) +/** + * A builder for creating a new instance of the AzureArcDataManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { AzureArcDataManagementClientImpl.class }) public final class AzureArcDataManagementClientBuilder { /* * The ID of the Azure subscription @@ -24,7 +26,7 @@ public final class AzureArcDataManagementClientBuilder { /** * Sets The ID of the Azure subscription. - * + * * @param subscriptionId the subscriptionId value. * @return the AzureArcDataManagementClientBuilder. */ @@ -40,7 +42,7 @@ public AzureArcDataManagementClientBuilder subscriptionId(String subscriptionId) /** * Sets server parameter. - * + * * @param endpoint the endpoint value. * @return the AzureArcDataManagementClientBuilder. */ @@ -56,7 +58,7 @@ public AzureArcDataManagementClientBuilder endpoint(String endpoint) { /** * Sets The environment to connect to. - * + * * @param environment the environment value. * @return the AzureArcDataManagementClientBuilder. */ @@ -72,7 +74,7 @@ public AzureArcDataManagementClientBuilder environment(AzureEnvironment environm /** * Sets The HTTP pipeline to send requests through. - * + * * @param pipeline the pipeline value. * @return the AzureArcDataManagementClientBuilder. */ @@ -88,7 +90,7 @@ public AzureArcDataManagementClientBuilder pipeline(HttpPipeline pipeline) { /** * Sets The default poll interval for long-running operation. - * + * * @param defaultPollInterval the defaultPollInterval value. * @return the AzureArcDataManagementClientBuilder. */ @@ -104,7 +106,7 @@ public AzureArcDataManagementClientBuilder defaultPollInterval(Duration defaultP /** * Sets The serializer to serialize an object into a string. - * + * * @param serializerAdapter the serializerAdapter value. * @return the AzureArcDataManagementClientBuilder. */ @@ -115,30 +117,22 @@ public AzureArcDataManagementClientBuilder serializerAdapter(SerializerAdapter s /** * Builds an instance of AzureArcDataManagementClientImpl with the provided parameters. - * + * * @return an instance of AzureArcDataManagementClientImpl. */ public AzureArcDataManagementClientImpl 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(); - AzureArcDataManagementClientImpl client = - new AzureArcDataManagementClientImpl( - localPipeline, - localSerializerAdapter, - localDefaultPollInterval, - localEnvironment, - subscriptionId, - localEndpoint); + 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(); + AzureArcDataManagementClientImpl client = new AzureArcDataManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); return client; } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientImpl.java index d26c401a6926..0f52c0342393 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientImpl.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.azurearcdata.implementation; import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpResponse; @@ -22,11 +23,18 @@ 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.azurearcdata.fluent.ActiveDirectoryConnectorsClient; import com.azure.resourcemanager.azurearcdata.fluent.AzureArcDataManagementClient; import com.azure.resourcemanager.azurearcdata.fluent.DataControllersClient; +import com.azure.resourcemanager.azurearcdata.fluent.FailoverGroupsClient; import com.azure.resourcemanager.azurearcdata.fluent.OperationsClient; +import com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient; import com.azure.resourcemanager.azurearcdata.fluent.SqlManagedInstancesClient; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerDatabasesClient; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerEsuLicensesClient; import com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerLicensesClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; @@ -36,132 +44,252 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** Initializes a new instance of the AzureArcDataManagementClientImpl type. */ +/** + * Initializes a new instance of the AzureArcDataManagementClientImpl type. + */ @ServiceClient(builder = AzureArcDataManagementClientBuilder.class) public final class AzureArcDataManagementClientImpl implements AzureArcDataManagementClient { - /** The ID of the Azure subscription. */ + /** + * The ID of the Azure subscription. + */ private final String subscriptionId; /** * Gets The ID of the Azure subscription. - * + * * @return the subscriptionId value. */ public String getSubscriptionId() { return this.subscriptionId; } - /** server parameter. */ + /** + * server parameter. + */ private final String endpoint; /** * Gets server parameter. - * + * * @return the endpoint value. */ public String getEndpoint() { return this.endpoint; } - /** Api Version. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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 OperationsClient object to access its operations. */ + /** + * 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 SqlManagedInstancesClient object to access its operations. */ + /** + * The SqlManagedInstancesClient object to access its operations. + */ private final SqlManagedInstancesClient sqlManagedInstances; /** * Gets the SqlManagedInstancesClient object to access its operations. - * + * * @return the SqlManagedInstancesClient object. */ public SqlManagedInstancesClient getSqlManagedInstances() { return this.sqlManagedInstances; } - /** The SqlServerInstancesClient object to access its operations. */ + /** + * The FailoverGroupsClient object to access its operations. + */ + private final FailoverGroupsClient failoverGroups; + + /** + * Gets the FailoverGroupsClient object to access its operations. + * + * @return the FailoverGroupsClient object. + */ + public FailoverGroupsClient getFailoverGroups() { + return this.failoverGroups; + } + + /** + * The SqlServerInstancesClient object to access its operations. + */ private final SqlServerInstancesClient sqlServerInstances; /** * Gets the SqlServerInstancesClient object to access its operations. - * + * * @return the SqlServerInstancesClient object. */ public SqlServerInstancesClient getSqlServerInstances() { return this.sqlServerInstances; } - /** The DataControllersClient object to access its operations. */ + /** + * The SqlServerLicensesClient object to access its operations. + */ + private final SqlServerLicensesClient sqlServerLicenses; + + /** + * Gets the SqlServerLicensesClient object to access its operations. + * + * @return the SqlServerLicensesClient object. + */ + public SqlServerLicensesClient getSqlServerLicenses() { + return this.sqlServerLicenses; + } + + /** + * The DataControllersClient object to access its operations. + */ private final DataControllersClient dataControllers; /** * Gets the DataControllersClient object to access its operations. - * + * * @return the DataControllersClient object. */ public DataControllersClient getDataControllers() { return this.dataControllers; } + /** + * The ActiveDirectoryConnectorsClient object to access its operations. + */ + private final ActiveDirectoryConnectorsClient activeDirectoryConnectors; + + /** + * Gets the ActiveDirectoryConnectorsClient object to access its operations. + * + * @return the ActiveDirectoryConnectorsClient object. + */ + public ActiveDirectoryConnectorsClient getActiveDirectoryConnectors() { + return this.activeDirectoryConnectors; + } + + /** + * The PostgresInstancesClient object to access its operations. + */ + private final PostgresInstancesClient postgresInstances; + + /** + * Gets the PostgresInstancesClient object to access its operations. + * + * @return the PostgresInstancesClient object. + */ + public PostgresInstancesClient getPostgresInstances() { + return this.postgresInstances; + } + + /** + * The SqlServerAvailabilityGroupsClient object to access its operations. + */ + private final SqlServerAvailabilityGroupsClient sqlServerAvailabilityGroups; + + /** + * Gets the SqlServerAvailabilityGroupsClient object to access its operations. + * + * @return the SqlServerAvailabilityGroupsClient object. + */ + public SqlServerAvailabilityGroupsClient getSqlServerAvailabilityGroups() { + return this.sqlServerAvailabilityGroups; + } + + /** + * The SqlServerDatabasesClient object to access its operations. + */ + private final SqlServerDatabasesClient sqlServerDatabases; + + /** + * Gets the SqlServerDatabasesClient object to access its operations. + * + * @return the SqlServerDatabasesClient object. + */ + public SqlServerDatabasesClient getSqlServerDatabases() { + return this.sqlServerDatabases; + } + + /** + * The SqlServerEsuLicensesClient object to access its operations. + */ + private final SqlServerEsuLicensesClient sqlServerEsuLicenses; + + /** + * Gets the SqlServerEsuLicensesClient object to access its operations. + * + * @return the SqlServerEsuLicensesClient object. + */ + public SqlServerEsuLicensesClient getSqlServerEsuLicenses() { + return this.sqlServerEsuLicenses; + } + /** * Initializes an instance of AzureArcDataManagementClient 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. @@ -169,28 +297,30 @@ public DataControllersClient getDataControllers() { * @param subscriptionId The ID of the Azure subscription. * @param endpoint server parameter. */ - AzureArcDataManagementClientImpl( - HttpPipeline httpPipeline, - SerializerAdapter serializerAdapter, - Duration defaultPollInterval, - AzureEnvironment environment, - String subscriptionId, - String endpoint) { + AzureArcDataManagementClientImpl(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 = "2021-08-01"; + this.apiVersion = "2024-05-01-preview"; this.operations = new OperationsClientImpl(this); this.sqlManagedInstances = new SqlManagedInstancesClientImpl(this); + this.failoverGroups = new FailoverGroupsClientImpl(this); this.sqlServerInstances = new SqlServerInstancesClientImpl(this); + this.sqlServerLicenses = new SqlServerLicensesClientImpl(this); this.dataControllers = new DataControllersClientImpl(this); + this.activeDirectoryConnectors = new ActiveDirectoryConnectorsClientImpl(this); + this.postgresInstances = new PostgresInstancesClientImpl(this); + this.sqlServerAvailabilityGroups = new SqlServerAvailabilityGroupsClientImpl(this); + this.sqlServerDatabases = new SqlServerDatabasesClientImpl(this); + this.sqlServerEsuLicenses = new SqlServerEsuLicensesClientImpl(this); } /** * Gets default client context. - * + * * @return the default client context. */ public Context getContext() { @@ -199,7 +329,7 @@ public Context getContext() { /** * Merges default client context with provided context. - * + * * @param context the context to be merged with default client context. * @return the merged context. */ @@ -209,7 +339,7 @@ public Context mergeContext(Context context) { /** * Gets long running operation result. - * + * * @param activationResponse the response of activation operation. * @param httpPipeline the http pipeline. * @param pollResultType type of poll result. @@ -219,26 +349,15 @@ public Context mergeContext(Context context) { * @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); + 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. @@ -251,19 +370,16 @@ public Mono getLroFinalResultOrError(AsyncPollResponse, HttpResponse errorResponse = null; PollResult.Error lroError = response.getValue().getError(); if (lroError != null) { - errorResponse = - new HttpResponseImpl( - lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + 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); + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); if (managementError.getCode() == null || managementError.getMessage() == null) { managementError = null; } @@ -304,7 +420,7 @@ public int getStatusCode() { } public String getHeaderValue(String s) { - return httpHeaders.getValue(s); + return httpHeaders.getValue(HttpHeaderName.fromString(s)); } public HttpHeaders getHeaders() { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllerResourceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllerResourceImpl.java index 0316fb5096d8..b898e174f056 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllerResourceImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllerResourceImpl.java @@ -90,20 +90,16 @@ public DataControllerResourceImpl withExistingResourceGroup(String resourceGroup } public DataControllerResource create() { - this.innerObject = - serviceManager - .serviceClient() - .getDataControllers() - .putDataController(resourceGroupName, dataControllerName, this.innerModel(), Context.NONE); + this.innerObject = serviceManager.serviceClient() + .getDataControllers() + .putDataController(resourceGroupName, dataControllerName, this.innerModel(), Context.NONE); return this; } public DataControllerResource create(Context context) { - this.innerObject = - serviceManager - .serviceClient() - .getDataControllers() - .putDataController(resourceGroupName, dataControllerName, this.innerModel(), context); + this.innerObject = serviceManager.serviceClient() + .getDataControllers() + .putDataController(resourceGroupName, dataControllerName, this.innerModel(), context); return this; } @@ -119,53 +115,40 @@ public DataControllerResourceImpl update() { } public DataControllerResource apply() { - this.innerObject = - serviceManager - .serviceClient() - .getDataControllers() - .patchDataControllerWithResponse( - resourceGroupName, dataControllerName, updateDataControllerResource, Context.NONE) - .getValue(); + this.innerObject = serviceManager.serviceClient() + .getDataControllers() + .patchDataController(resourceGroupName, dataControllerName, updateDataControllerResource, Context.NONE); return this; } public DataControllerResource apply(Context context) { - this.innerObject = - serviceManager - .serviceClient() - .getDataControllers() - .patchDataControllerWithResponse( - resourceGroupName, dataControllerName, updateDataControllerResource, context) - .getValue(); + this.innerObject = serviceManager.serviceClient() + .getDataControllers() + .patchDataController(resourceGroupName, dataControllerName, updateDataControllerResource, context); return this; } - DataControllerResourceImpl( - DataControllerResourceInner innerObject, + DataControllerResourceImpl(DataControllerResourceInner innerObject, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; - this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.dataControllerName = Utils.getValueFromIdByName(innerObject.id(), "dataControllers"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.dataControllerName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "dataControllers"); } public DataControllerResource refresh() { - this.innerObject = - serviceManager - .serviceClient() - .getDataControllers() - .getByResourceGroupWithResponse(resourceGroupName, dataControllerName, Context.NONE) - .getValue(); + this.innerObject = serviceManager.serviceClient() + .getDataControllers() + .getByResourceGroupWithResponse(resourceGroupName, dataControllerName, Context.NONE) + .getValue(); return this; } public DataControllerResource refresh(Context context) { - this.innerObject = - serviceManager - .serviceClient() - .getDataControllers() - .getByResourceGroupWithResponse(resourceGroupName, dataControllerName, context) - .getValue(); + this.innerObject = serviceManager.serviceClient() + .getDataControllers() + .getByResourceGroupWithResponse(resourceGroupName, dataControllerName, context) + .getValue(); return this; } @@ -180,8 +163,13 @@ public DataControllerResourceImpl withRegion(String location) { } public DataControllerResourceImpl withProperties(DataControllerProperties properties) { - this.innerModel().withProperties(properties); - return this; + if (isInCreateMode()) { + this.innerModel().withProperties(properties); + return this; + } else { + this.updateDataControllerResource.withProperties(properties); + return this; + } } public DataControllerResourceImpl withTags(Map tags) { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersClientImpl.java index 460100bd7f40..7f62a3595b13 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersClientImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersClientImpl.java @@ -40,22 +40,28 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in DataControllersClient. */ +/** + * An instance of this class provides access to all the operations defined in DataControllersClient. + */ public final class DataControllersClientImpl implements DataControllersClient { - /** The proxy service used to perform REST calls. */ + /** + * The proxy service used to perform REST calls. + */ private final DataControllersService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final AzureArcDataManagementClientImpl client; /** * Initializes an instance of DataControllersClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ DataControllersClientImpl(AzureArcDataManagementClientImpl client) { - this.service = - RestProxy.create(DataControllersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.service + = RestProxy.create(DataControllersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } @@ -66,235 +72,170 @@ public final class DataControllersClientImpl implements DataControllersClient { @Host("{$host}") @ServiceInterface(name = "AzureArcDataManageme") public interface DataControllersService { - @Headers({"Content-Type: application/json"}) + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/dataControllers") - @ExpectedResponses({200}) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list( - @HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/dataControllers") - @ExpectedResponses({200}) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup( - @HostParam("$host") String endpoint, + Mono> listByResourceGroup(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/dataControllers/{dataControllerName}") - @ExpectedResponses({200, 201}) + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") + @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> putDataController( - @HostParam("$host") String endpoint, + Mono>> putDataController(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("dataControllerName") String dataControllerName, - @QueryParam("api-version") String apiVersion, + @PathParam("dataControllerName") String dataControllerName, @QueryParam("api-version") String apiVersion, @BodyParam("application/json") DataControllerResourceInner dataControllerResource, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/dataControllers/{dataControllerName}") - @ExpectedResponses({200, 202, 204}) + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") + @ExpectedResponses({ 200, 202, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete( - @HostParam("$host") String endpoint, + Mono>> delete(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("dataControllerName") String dataControllerName, - @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/dataControllers/{dataControllerName}") - @ExpectedResponses({200}) + @PathParam("dataControllerName") String dataControllerName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup( - @HostParam("$host") String endpoint, + Mono> getByResourceGroup(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("dataControllerName") String dataControllerName, - @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/dataControllers/{dataControllerName}") - @ExpectedResponses({200}) + @PathParam("dataControllerName") String dataControllerName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") + @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> patchDataController( - @HostParam("$host") String endpoint, + Mono>> patchDataController(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("dataControllerName") String dataControllerName, - @QueryParam("api-version") String apiVersion, + @PathParam("dataControllerName") String dataControllerName, @QueryParam("api-version") String apiVersion, @BodyParam("application/json") DataControllerUpdate dataControllerResource, - @HeaderParam("Accept") String accept, - Context context); + @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") - @ExpectedResponses({200}) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listInSubscriptionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") - @ExpectedResponses({200}) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listInGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** * List dataController resources in the 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 the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of data controllers 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.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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.getSubscriptionId(), - this.client.getApiVersion(), - accept, - context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getApiVersion(), 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 dataController resources in the 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 the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of data controllers 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.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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.getSubscriptionId(), - this.client.getApiVersion(), - accept, + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** * List dataController resources in the 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 the paginated response with {@link PagedFlux}. + * @return a list of data controllers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync() { - return new PagedFlux<>( - () -> listSinglePageAsync(), nextLink -> listInSubscriptionNextSinglePageAsync(nextLink)); + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listInSubscriptionNextSinglePageAsync(nextLink)); } /** * List dataController resources in the 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 the paginated response with {@link PagedFlux}. + * @return a list of data controllers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Context context) { - return new PagedFlux<>( - () -> listSinglePageAsync(context), nextLink -> listInSubscriptionNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listInSubscriptionNextSinglePageAsync(nextLink, context)); } /** * List dataController resources in the 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 the paginated response with {@link PagedIterable}. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { @@ -303,12 +244,12 @@ public PagedIterable list() { /** * List dataController resources in the 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 the paginated response with {@link PagedIterable}. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { @@ -317,27 +258,23 @@ public PagedIterable list(Context context) { /** * List dataController resources in the resource group. - * + * * @param resourceGroupName The name of the Azure resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of data controllers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync( - String resourceGroupName) { + 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.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -345,52 +282,33 @@ private Mono> listByResourceGroupSing } final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service - .listByResourceGroup( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - this.client.getApiVersion(), - accept, - context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), 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 dataController resources in the resource group. - * + * * @param resourceGroupName The name of the Azure resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of data controllers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync( - String resourceGroupName, Context context) { + 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.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -399,65 +317,51 @@ private Mono> listByResourceGroupSing final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listByResourceGroup( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - this.client.getApiVersion(), - accept, - context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + .listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** * List dataController resources in the resource group. - * + * * @param resourceGroupName The name of the Azure resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedFlux}. + * @return a list of data controllers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>( - () -> listByResourceGroupSinglePageAsync(resourceGroupName), + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listInGroupNextSinglePageAsync(nextLink)); } /** * List dataController resources in the resource group. - * + * * @param resourceGroupName The name of the Azure resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedFlux}. + * @return a list of data controllers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>( - () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), nextLink -> listInGroupNextSinglePageAsync(nextLink, context)); } /** * List dataController resources in the resource group. - * + * * @param resourceGroupName The name of the Azure resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName) { @@ -466,13 +370,13 @@ public PagedIterable listByResourceGroup(String res /** * List dataController resources in the resource group. - * + * * @param resourceGroupName The name of the Azure resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { @@ -481,9 +385,9 @@ public PagedIterable listByResourceGroup(String res /** * Creates or replaces a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -491,19 +395,15 @@ public PagedIterable listByResourceGroup(String res * @return data controller resource along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> putDataControllerWithResponseAsync( - String resourceGroupName, String dataControllerName, DataControllerResourceInner dataControllerResource) { + private Mono>> putDataControllerWithResponseAsync(String resourceGroupName, + String dataControllerName, DataControllerResourceInner dataControllerResource) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -514,34 +414,24 @@ private Mono>> putDataControllerWithResponseAsync( .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); } if (dataControllerResource == null) { - return Mono - .error( - new IllegalArgumentException("Parameter dataControllerResource is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter dataControllerResource is required and cannot be null.")); } else { dataControllerResource.validate(); } final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service - .putDataController( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - dataControllerName, - this.client.getApiVersion(), - dataControllerResource, - accept, - context)) + .withContext(context -> service.putDataController(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, this.client.getApiVersion(), + dataControllerResource, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Creates or replaces a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -550,22 +440,15 @@ private Mono>> putDataControllerWithResponseAsync( * @return data controller resource along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> putDataControllerWithResponseAsync( - String resourceGroupName, - String dataControllerName, - DataControllerResourceInner dataControllerResource, - Context context) { + private Mono>> putDataControllerWithResponseAsync(String resourceGroupName, + String dataControllerName, DataControllerResourceInner dataControllerResource, Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -576,31 +459,22 @@ private Mono>> putDataControllerWithResponseAsync( .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); } if (dataControllerResource == null) { - return Mono - .error( - new IllegalArgumentException("Parameter dataControllerResource is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter dataControllerResource is required and cannot be null.")); } else { dataControllerResource.validate(); } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .putDataController( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - dataControllerName, - this.client.getApiVersion(), - dataControllerResource, - accept, - context); + return service.putDataController(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + dataControllerName, this.client.getApiVersion(), dataControllerResource, accept, context); } /** * Creates or replaces a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -609,25 +483,20 @@ private Mono>> putDataControllerWithResponseAsync( */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, DataControllerResourceInner> - beginPutDataControllerAsync( - String resourceGroupName, String dataControllerName, DataControllerResourceInner dataControllerResource) { - Mono>> mono = - putDataControllerWithResponseAsync(resourceGroupName, dataControllerName, dataControllerResource); - return this - .client - .getLroResult( - mono, - this.client.getHttpPipeline(), - DataControllerResourceInner.class, - DataControllerResourceInner.class, - this.client.getContext()); + beginPutDataControllerAsync(String resourceGroupName, String dataControllerName, + DataControllerResourceInner dataControllerResource) { + Mono>> mono + = putDataControllerWithResponseAsync(resourceGroupName, dataControllerName, dataControllerResource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DataControllerResourceInner.class, DataControllerResourceInner.class, + this.client.getContext()); } /** * Creates or replaces a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -637,29 +506,21 @@ private Mono>> putDataControllerWithResponseAsync( */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, DataControllerResourceInner> - beginPutDataControllerAsync( - String resourceGroupName, - String dataControllerName, - DataControllerResourceInner dataControllerResource, - Context context) { + beginPutDataControllerAsync(String resourceGroupName, String dataControllerName, + DataControllerResourceInner dataControllerResource, Context context) { context = this.client.mergeContext(context); - Mono>> mono = - putDataControllerWithResponseAsync(resourceGroupName, dataControllerName, dataControllerResource, context); - return this - .client - .getLroResult( - mono, - this.client.getHttpPipeline(), - DataControllerResourceInner.class, - DataControllerResourceInner.class, - context); + Mono>> mono = putDataControllerWithResponseAsync(resourceGroupName, + dataControllerName, dataControllerResource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DataControllerResourceInner.class, DataControllerResourceInner.class, + context); } /** * Creates or replaces a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -669,16 +530,15 @@ private Mono>> putDataControllerWithResponseAsync( @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, DataControllerResourceInner> beginPutDataController( String resourceGroupName, String dataControllerName, DataControllerResourceInner dataControllerResource) { - return this - .beginPutDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource) + return this.beginPutDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource) .getSyncPoller(); } /** * Creates or replaces a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -688,20 +548,17 @@ public SyncPoller, DataControllerResourc */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, DataControllerResourceInner> beginPutDataController( - String resourceGroupName, - String dataControllerName, - DataControllerResourceInner dataControllerResource, + String resourceGroupName, String dataControllerName, DataControllerResourceInner dataControllerResource, Context context) { - return this - .beginPutDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource, context) + return this.beginPutDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource, context) .getSyncPoller(); } /** * Creates or replaces a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -709,18 +566,17 @@ public SyncPoller, DataControllerResourc * @return data controller resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono putDataControllerAsync( - String resourceGroupName, String dataControllerName, DataControllerResourceInner dataControllerResource) { - return beginPutDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource) - .last() + private Mono putDataControllerAsync(String resourceGroupName, + String dataControllerName, DataControllerResourceInner dataControllerResource) { + return beginPutDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource).last() .flatMap(this.client::getLroFinalResultOrError); } /** * Creates or replaces a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -729,11 +585,8 @@ private Mono putDataControllerAsync( * @return data controller resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono putDataControllerAsync( - String resourceGroupName, - String dataControllerName, - DataControllerResourceInner dataControllerResource, - Context context) { + private Mono putDataControllerAsync(String resourceGroupName, + String dataControllerName, DataControllerResourceInner dataControllerResource, Context context) { return beginPutDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource, context) .last() .flatMap(this.client::getLroFinalResultOrError); @@ -741,9 +594,9 @@ private Mono putDataControllerAsync( /** * Creates or replaces a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -751,16 +604,16 @@ private Mono putDataControllerAsync( * @return data controller resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public DataControllerResourceInner putDataController( - String resourceGroupName, String dataControllerName, DataControllerResourceInner dataControllerResource) { + public DataControllerResourceInner putDataController(String resourceGroupName, String dataControllerName, + DataControllerResourceInner dataControllerResource) { return putDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource).block(); } /** * Creates or replaces a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -769,38 +622,31 @@ public DataControllerResourceInner putDataController( * @return data controller resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public DataControllerResourceInner putDataController( - String resourceGroupName, - String dataControllerName, - DataControllerResourceInner dataControllerResource, - Context context) { + public DataControllerResourceInner putDataController(String resourceGroupName, String dataControllerName, + DataControllerResourceInner dataControllerResource, Context context) { return putDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource, context).block(); } /** * Deletes a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 dataControllerName) { + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String dataControllerName) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -812,25 +658,16 @@ private Mono>> deleteWithResponseAsync( } final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service - .delete( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - dataControllerName, - this.client.getApiVersion(), - accept, - context)) + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, dataControllerName, this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Deletes a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -838,19 +675,15 @@ private Mono>> deleteWithResponseAsync( * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync( - String resourceGroupName, String dataControllerName, Context context) { + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String dataControllerName, Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -862,22 +695,15 @@ private Mono>> deleteWithResponseAsync( } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .delete( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - dataControllerName, - this.client.getApiVersion(), - accept, - context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + dataControllerName, this.client.getApiVersion(), accept, context); } /** * Deletes a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -886,17 +712,15 @@ private Mono>> deleteWithResponseAsync( @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String dataControllerName) { Mono>> mono = deleteWithResponseAsync(resourceGroupName, dataControllerName); - return this - .client - .getLroResult( - mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); } /** * Deletes a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -904,20 +728,19 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync( - String resourceGroupName, String dataControllerName, Context context) { + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String dataControllerName, + Context context) { context = this.client.mergeContext(context); Mono>> mono = deleteWithResponseAsync(resourceGroupName, dataControllerName, context); - return this - .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); } /** * Deletes a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -930,9 +753,9 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, /** * Deletes a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -940,16 +763,16 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete( - String resourceGroupName, String dataControllerName, Context context) { + public SyncPoller, Void> beginDelete(String resourceGroupName, String dataControllerName, + Context context) { return this.beginDeleteAsync(resourceGroupName, dataControllerName, context).getSyncPoller(); } /** * Deletes a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -957,16 +780,15 @@ public SyncPoller, Void> beginDelete( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String dataControllerName) { - return beginDeleteAsync(resourceGroupName, dataControllerName) - .last() + return beginDeleteAsync(resourceGroupName, dataControllerName).last() .flatMap(this.client::getLroFinalResultOrError); } /** * Deletes a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -975,16 +797,15 @@ private Mono deleteAsync(String resourceGroupName, String dataControllerNa */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String dataControllerName, Context context) { - return beginDeleteAsync(resourceGroupName, dataControllerName, context) - .last() + return beginDeleteAsync(resourceGroupName, dataControllerName, context).last() .flatMap(this.client::getLroFinalResultOrError); } /** * Deletes a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -996,9 +817,9 @@ public void delete(String resourceGroupName, String dataControllerName) { /** * Deletes a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1011,28 +832,24 @@ public void delete(String resourceGroupName, String dataControllerName, Context /** * Retrieves a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data controller resource along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync( - String resourceGroupName, String dataControllerName) { + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String dataControllerName) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -1045,24 +862,16 @@ private Mono> getByResourceGroupWithRespon final String accept = "application/json"; return FluxUtil .withContext( - context -> - service - .getByResourceGroup( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - dataControllerName, - this.client.getApiVersion(), - accept, - context)) + context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, dataControllerName, this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Retrieves a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1070,19 +879,15 @@ private Mono> getByResourceGroupWithRespon * @return data controller resource along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync( - String resourceGroupName, String dataControllerName, Context context) { + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String dataControllerName, Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -1094,39 +899,32 @@ private Mono> getByResourceGroupWithRespon } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .getByResourceGroup( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - dataControllerName, - this.client.getApiVersion(), - accept, - context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + dataControllerName, this.client.getApiVersion(), accept, context); } /** * Retrieves a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data controller resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync( - String resourceGroupName, String dataControllerName) { + private Mono getByResourceGroupAsync(String resourceGroupName, + String dataControllerName) { return getByResourceGroupWithResponseAsync(resourceGroupName, dataControllerName) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Retrieves a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1134,16 +932,16 @@ private Mono getByResourceGroupAsync( * @return data controller resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse( - String resourceGroupName, String dataControllerName, Context context) { + public Response getByResourceGroupWithResponse(String resourceGroupName, + String dataControllerName, Context context) { return getByResourceGroupWithResponseAsync(resourceGroupName, dataControllerName, context).block(); } /** * Retrieves a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1156,9 +954,9 @@ public DataControllerResourceInner getByResourceGroup(String resourceGroupName, /** * Updates a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource The update data controller resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1166,19 +964,15 @@ public DataControllerResourceInner getByResourceGroup(String resourceGroupName, * @return data controller resource along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> patchDataControllerWithResponseAsync( - String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource) { + private Mono>> patchDataControllerWithResponseAsync(String resourceGroupName, + String dataControllerName, DataControllerUpdate dataControllerResource) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -1189,34 +983,24 @@ private Mono> patchDataControllerWithRespo .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); } if (dataControllerResource == null) { - return Mono - .error( - new IllegalArgumentException("Parameter dataControllerResource is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter dataControllerResource is required and cannot be null.")); } else { dataControllerResource.validate(); } final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service - .patchDataController( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - dataControllerName, - this.client.getApiVersion(), - dataControllerResource, - accept, - context)) + .withContext(context -> service.patchDataController(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, this.client.getApiVersion(), + dataControllerResource, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Updates a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource The update data controller resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1225,22 +1009,15 @@ private Mono> patchDataControllerWithRespo * @return data controller resource along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> patchDataControllerWithResponseAsync( - String resourceGroupName, - String dataControllerName, - DataControllerUpdate dataControllerResource, - Context context) { + private Mono>> patchDataControllerWithResponseAsync(String resourceGroupName, + String dataControllerName, DataControllerUpdate dataControllerResource, Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -1251,31 +1028,108 @@ private Mono> patchDataControllerWithRespo .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); } if (dataControllerResource == null) { - return Mono - .error( - new IllegalArgumentException("Parameter dataControllerResource is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter dataControllerResource is required and cannot be null.")); } else { dataControllerResource.validate(); } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .patchDataController( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - dataControllerName, - this.client.getApiVersion(), - dataControllerResource, - accept, - context); + return service.patchDataController(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, dataControllerName, this.client.getApiVersion(), dataControllerResource, accept, + context); + } + + /** + * Updates a dataController resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of data controller resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DataControllerResourceInner> + beginPatchDataControllerAsync(String resourceGroupName, String dataControllerName, + DataControllerUpdate dataControllerResource) { + Mono>> mono + = patchDataControllerWithResponseAsync(resourceGroupName, dataControllerName, dataControllerResource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DataControllerResourceInner.class, DataControllerResourceInner.class, + this.client.getContext()); + } + + /** + * Updates a dataController resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller 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 the {@link PollerFlux} for polling of data controller resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DataControllerResourceInner> + beginPatchDataControllerAsync(String resourceGroupName, String dataControllerName, + DataControllerUpdate dataControllerResource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = patchDataControllerWithResponseAsync(resourceGroupName, + dataControllerName, dataControllerResource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DataControllerResourceInner.class, DataControllerResourceInner.class, + context); + } + + /** + * Updates a dataController resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of data controller resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DataControllerResourceInner> beginPatchDataController( + String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource) { + return this.beginPatchDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource) + .getSyncPoller(); + } + + /** + * Updates a dataController resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller 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 the {@link SyncPoller} for polling of data controller resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DataControllerResourceInner> beginPatchDataController( + String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource, + Context context) { + return this + .beginPatchDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource, context) + .getSyncPoller(); } /** * Updates a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource The update data controller resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1283,40 +1137,37 @@ private Mono> patchDataControllerWithRespo * @return data controller resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono patchDataControllerAsync( - String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource) { - return patchDataControllerWithResponseAsync(resourceGroupName, dataControllerName, dataControllerResource) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono patchDataControllerAsync(String resourceGroupName, + String dataControllerName, DataControllerUpdate dataControllerResource) { + return beginPatchDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource).last() + .flatMap(this.client::getLroFinalResultOrError); } /** * Updates a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource The update data controller 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 data controller resource along with {@link Response}. + * @return data controller resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchDataControllerWithResponse( - String resourceGroupName, - String dataControllerName, - DataControllerUpdate dataControllerResource, - Context context) { - return patchDataControllerWithResponseAsync( - resourceGroupName, dataControllerName, dataControllerResource, context) - .block(); + private Mono patchDataControllerAsync(String resourceGroupName, + String dataControllerName, DataControllerUpdate dataControllerResource, Context context) { + return beginPatchDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** * Updates a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param dataControllerResource The update data controller resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1324,22 +1175,37 @@ public Response patchDataControllerWithResponse( * @return data controller resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public DataControllerResourceInner patchDataController( - String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource) { - return patchDataControllerWithResponse( - resourceGroupName, dataControllerName, dataControllerResource, Context.NONE) - .getValue(); + public DataControllerResourceInner patchDataController(String resourceGroupName, String dataControllerName, + DataControllerUpdate dataControllerResource) { + return patchDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource).block(); + } + + /** + * Updates a dataController resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller 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 data controller resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataControllerResourceInner patchDataController(String resourceGroupName, String dataControllerName, + DataControllerUpdate dataControllerResource, Context context) { + return patchDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource, context).block(); } /** * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of data controllers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listInSubscriptionNextSinglePageAsync(String nextLink) { @@ -1347,74 +1213,53 @@ private Mono> listInSubscriptionNextS 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.")); + 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.listInSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + .>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 nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of data controllers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listInSubscriptionNextSinglePageAsync( - String nextLink, Context context) { + private Mono> listInSubscriptionNextSinglePageAsync(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.")); + 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 - .listInSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + return service.listInSubscriptionNext(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. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of data controllers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listInGroupNextSinglePageAsync(String nextLink) { @@ -1422,61 +1267,41 @@ private Mono> listInGroupNextSinglePa 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.")); + 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.listInGroupNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + .>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 nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of data controllers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listInGroupNextSinglePageAsync( - String nextLink, Context context) { + private Mono> listInGroupNextSinglePageAsync(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.")); + 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 - .listInGroupNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + return service.listInGroupNext(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/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersImpl.java index cb0764a70e7f..03af68dfaa61 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersImpl.java @@ -21,31 +21,31 @@ public final class DataControllersImpl implements DataControllers { private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; - public DataControllersImpl( - DataControllersClient innerClient, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + public DataControllersImpl(DataControllersClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable list() { PagedIterable inner = this.serviceClient().list(); - return Utils.mapPage(inner, inner1 -> new DataControllerResourceImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DataControllerResourceImpl(inner1, this.manager())); } public PagedIterable list(Context context) { PagedIterable inner = this.serviceClient().list(context); - return Utils.mapPage(inner, inner1 -> new DataControllerResourceImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DataControllerResourceImpl(inner1, this.manager())); } public PagedIterable listByResourceGroup(String resourceGroupName) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return Utils.mapPage(inner, inner1 -> new DataControllerResourceImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DataControllerResourceImpl(inner1, this.manager())); } public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - PagedIterable inner = - this.serviceClient().listByResourceGroup(resourceGroupName, context); - return Utils.mapPage(inner, inner1 -> new DataControllerResourceImpl(inner1, this.manager())); + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DataControllerResourceImpl(inner1, this.manager())); } public void deleteByResourceGroup(String resourceGroupName, String dataControllerName) { @@ -56,15 +56,12 @@ public void delete(String resourceGroupName, String dataControllerName, Context this.serviceClient().delete(resourceGroupName, dataControllerName, context); } - public Response getByResourceGroupWithResponse( - String resourceGroupName, String dataControllerName, Context context) { - Response inner = - this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, dataControllerName, context); + public Response getByResourceGroupWithResponse(String resourceGroupName, + String dataControllerName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, dataControllerName, context); if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), new DataControllerResourceImpl(inner.getValue(), this.manager())); } else { return null; @@ -72,8 +69,8 @@ public Response getByResourceGroupWithResponse( } public DataControllerResource getByResourceGroup(String resourceGroupName, String dataControllerName) { - DataControllerResourceInner inner = - this.serviceClient().getByResourceGroup(resourceGroupName, dataControllerName); + DataControllerResourceInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, dataControllerName); if (inner != null) { return new DataControllerResourceImpl(inner, this.manager()); } else { @@ -82,81 +79,57 @@ public DataControllerResource getByResourceGroup(String resourceGroupName, Strin } public DataControllerResource getById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.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))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String dataControllerName = Utils.getValueFromIdByName(id, "dataControllers"); + String dataControllerName = ResourceManagerUtils.getValueFromIdByName(id, "dataControllers"); if (dataControllerName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'dataControllers'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataControllers'.", id))); } return this.getByResourceGroupWithResponse(resourceGroupName, dataControllerName, Context.NONE).getValue(); } public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.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))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String dataControllerName = Utils.getValueFromIdByName(id, "dataControllers"); + String dataControllerName = ResourceManagerUtils.getValueFromIdByName(id, "dataControllers"); if (dataControllerName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'dataControllers'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataControllers'.", id))); } return this.getByResourceGroupWithResponse(resourceGroupName, dataControllerName, context); } public void deleteById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.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))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String dataControllerName = Utils.getValueFromIdByName(id, "dataControllers"); + String dataControllerName = ResourceManagerUtils.getValueFromIdByName(id, "dataControllers"); if (dataControllerName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'dataControllers'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataControllers'.", id))); } this.delete(resourceGroupName, dataControllerName, Context.NONE); } public void deleteByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.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))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String dataControllerName = Utils.getValueFromIdByName(id, "dataControllers"); + String dataControllerName = ResourceManagerUtils.getValueFromIdByName(id, "dataControllers"); if (dataControllerName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'dataControllers'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataControllers'.", id))); } this.delete(resourceGroupName, dataControllerName, context); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupResourceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupResourceImpl.java new file mode 100644 index 000000000000..c1b1269213b9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupResourceImpl.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.FailoverGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupProperties; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupResource; + +public final class FailoverGroupResourceImpl implements FailoverGroupResource, FailoverGroupResource.Definition { + private FailoverGroupResourceInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + FailoverGroupResourceImpl(FailoverGroupResourceInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager 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 FailoverGroupProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public FailoverGroupResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sqlManagedInstanceName; + + private String failoverGroupName; + + public FailoverGroupResourceImpl withExistingSqlManagedInstance(String resourceGroupName, + String sqlManagedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.sqlManagedInstanceName = sqlManagedInstanceName; + return this; + } + + public FailoverGroupResource create() { + this.innerObject = serviceManager.serviceClient() + .getFailoverGroups() + .create(resourceGroupName, sqlManagedInstanceName, failoverGroupName, this.innerModel(), Context.NONE); + return this; + } + + public FailoverGroupResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFailoverGroups() + .create(resourceGroupName, sqlManagedInstanceName, failoverGroupName, this.innerModel(), context); + return this; + } + + FailoverGroupResourceImpl(String name, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new FailoverGroupResourceInner(); + this.serviceManager = serviceManager; + this.failoverGroupName = name; + } + + public FailoverGroupResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getFailoverGroups() + .getWithResponse(resourceGroupName, sqlManagedInstanceName, failoverGroupName, Context.NONE) + .getValue(); + return this; + } + + public FailoverGroupResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFailoverGroups() + .getWithResponse(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context) + .getValue(); + return this; + } + + public FailoverGroupResourceImpl withProperties(FailoverGroupProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsClientImpl.java new file mode 100644 index 000000000000..a58a8958f349 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsClientImpl.java @@ -0,0 +1,951 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.azurearcdata.fluent.FailoverGroupsClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.FailoverGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupListResult; +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 FailoverGroupsClient. + */ +public final class FailoverGroupsClientImpl implements FailoverGroupsClient { + /** + * The proxy service used to perform REST calls. + */ + private final FailoverGroupsService service; + + /** + * The service client containing this operation class. + */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of FailoverGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FailoverGroupsClientImpl(AzureArcDataManagementClientImpl client) { + this.service + = RestProxy.create(FailoverGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientFailoverGroups to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureArcDataManageme") + public interface FailoverGroupsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, + @PathParam("failoverGroupName") String failoverGroupName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FailoverGroupResourceInner failoverGroupResource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, + @PathParam("failoverGroupName") String failoverGroupName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, + @PathParam("failoverGroupName") String failoverGroupName, @QueryParam("api-version") String apiVersion, + @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); + } + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String sqlManagedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlManagedInstanceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlManagedInstanceName, this.client.getApiVersion(), 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 the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String sqlManagedInstanceName, 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 (sqlManagedInstanceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, + this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String sqlManagedInstanceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, sqlManagedInstanceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String sqlManagedInstanceName, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, sqlManagedInstanceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String sqlManagedInstanceName) { + return new PagedIterable<>(listAsync(resourceGroupName, sqlManagedInstanceName)); + } + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String sqlManagedInstanceName, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, sqlManagedInstanceName, context)); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName, String failoverGroupName, FailoverGroupResourceInner failoverGroupResource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlManagedInstanceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (failoverGroupResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupResource is required and cannot be null.")); + } else { + failoverGroupResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlManagedInstanceName, failoverGroupName, this.client.getApiVersion(), + failoverGroupResource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName, String failoverGroupName, FailoverGroupResourceInner failoverGroupResource, + 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 (sqlManagedInstanceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (failoverGroupResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupResource is required and cannot be null.")); + } else { + failoverGroupResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlManagedInstanceName, failoverGroupName, this.client.getApiVersion(), failoverGroupResource, accept, + context); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a failover group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FailoverGroupResourceInner> beginCreateAsync( + String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, + FailoverGroupResourceInner failoverGroupResource) { + Mono>> mono = createWithResponseAsync(resourceGroupName, sqlManagedInstanceName, + failoverGroupName, failoverGroupResource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), FailoverGroupResourceInner.class, FailoverGroupResourceInner.class, + this.client.getContext()); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a failover group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FailoverGroupResourceInner> beginCreateAsync( + String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, + FailoverGroupResourceInner failoverGroupResource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createWithResponseAsync(resourceGroupName, sqlManagedInstanceName, + failoverGroupName, failoverGroupResource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), FailoverGroupResourceInner.class, FailoverGroupResourceInner.class, context); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FailoverGroupResourceInner> beginCreate( + String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, + FailoverGroupResourceInner failoverGroupResource) { + return this + .beginCreateAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, failoverGroupResource) + .getSyncPoller(); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FailoverGroupResourceInner> beginCreate( + String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, + FailoverGroupResourceInner failoverGroupResource, Context context) { + return this + .beginCreateAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, failoverGroupResource, + context) + .getSyncPoller(); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, FailoverGroupResourceInner failoverGroupResource) { + return beginCreateAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, failoverGroupResource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, FailoverGroupResourceInner failoverGroupResource, Context context) { + return beginCreateAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, failoverGroupResource, + context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupResourceInner create(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, FailoverGroupResourceInner failoverGroupResource) { + return createAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, failoverGroupResource).block(); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupResourceInner create(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, FailoverGroupResourceInner failoverGroupResource, Context context) { + return createAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, failoverGroupResource, context) + .block(); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName, String failoverGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlManagedInstanceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlManagedInstanceName, failoverGroupName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName, String failoverGroupName, 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 (sqlManagedInstanceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlManagedInstanceName, failoverGroupName, this.client.getApiVersion(), accept, context); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName) { + return this.beginDeleteAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName).getSyncPoller(); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, Context context) { + return this.beginDeleteAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context) + .getSyncPoller(); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName) { + return beginDeleteAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, + Context context) { + return beginDeleteAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName) { + deleteAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName).block(); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, + Context context) { + deleteAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context).block(); + } + + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName, String failoverGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlManagedInstanceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlManagedInstanceName, failoverGroupName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName, String failoverGroupName, 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 (sqlManagedInstanceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlManagedInstanceName, failoverGroupName, this.client.getApiVersion(), accept, context); + } + + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName) { + return getWithResponseAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context).block(); + } + + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupResourceInner get(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName) { + return getWithResponse(resourceGroupName, sqlManagedInstanceName, failoverGroupName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsImpl.java new file mode 100644 index 000000000000..5eb6ed9a12f5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.azurearcdata.fluent.FailoverGroupsClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.FailoverGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupResource; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroups; + +public final class FailoverGroupsImpl implements FailoverGroups { + private static final ClientLogger LOGGER = new ClientLogger(FailoverGroupsImpl.class); + + private final FailoverGroupsClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public FailoverGroupsImpl(FailoverGroupsClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String sqlManagedInstanceName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, sqlManagedInstanceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FailoverGroupResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String sqlManagedInstanceName, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, sqlManagedInstanceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FailoverGroupResourceImpl(inner1, this.manager())); + } + + public void delete(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName) { + this.serviceClient().delete(resourceGroupName, sqlManagedInstanceName, failoverGroupName); + } + + public void delete(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, + Context context) { + this.serviceClient().delete(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context); + } + + public Response getWithResponse(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new FailoverGroupResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public FailoverGroupResource get(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName) { + FailoverGroupResourceInner inner + = this.serviceClient().get(resourceGroupName, sqlManagedInstanceName, failoverGroupName); + if (inner != null) { + return new FailoverGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public FailoverGroupResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 sqlManagedInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlManagedInstances"); + if (sqlManagedInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlManagedInstances'.", id))); + } + String failoverGroupName = ResourceManagerUtils.getValueFromIdByName(id, "failoverGroups"); + if (failoverGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'failoverGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, sqlManagedInstanceName, failoverGroupName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 sqlManagedInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlManagedInstances"); + if (sqlManagedInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlManagedInstances'.", id))); + } + String failoverGroupName = ResourceManagerUtils.getValueFromIdByName(id, "failoverGroups"); + if (failoverGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'failoverGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.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 sqlManagedInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlManagedInstances"); + if (sqlManagedInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlManagedInstances'.", id))); + } + String failoverGroupName = ResourceManagerUtils.getValueFromIdByName(id, "failoverGroups"); + if (failoverGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'failoverGroups'.", id))); + } + this.delete(resourceGroupName, sqlManagedInstanceName, failoverGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 sqlManagedInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlManagedInstances"); + if (sqlManagedInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlManagedInstances'.", id))); + } + String failoverGroupName = ResourceManagerUtils.getValueFromIdByName(id, "failoverGroups"); + if (failoverGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'failoverGroups'.", id))); + } + this.delete(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context); + } + + private FailoverGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public FailoverGroupResourceImpl define(String name) { + return new FailoverGroupResourceImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationImpl.java index 6101437c1e4c..f371a1f74871 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationImpl.java @@ -16,8 +16,8 @@ public final class OperationImpl implements Operation { private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; - OperationImpl( - OperationInner innerObject, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsClientImpl.java index e9fe84874dee..82715ad4c65c 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsClientImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsClientImpl.java @@ -30,22 +30,28 @@ import com.azure.resourcemanager.azurearcdata.models.OperationListResult; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in OperationsClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final OperationsService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final AzureArcDataManagementClientImpl client; /** * Initializes an instance of OperationsClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ OperationsClientImpl(AzureArcDataManagementClientImpl client) { - this.service = - RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } @@ -56,99 +62,74 @@ public final class OperationsClientImpl implements OperationsClient { @Host("{$host}") @ServiceInterface(name = "AzureArcDataManageme") public interface OperationsService { - @Headers({"Content-Type: application/json"}) + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.AzureArcData/operations") - @ExpectedResponses({200}) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") - @ExpectedResponses({200}) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** * Lists all of the available Azure Data Services on Azure Arc 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 result of the request to list Azure Data Services on Azure Arc operations along with {@link - * PagedResponse} on successful completion of {@link Mono}. + * @return result of the request to list Azure Data Services on Azure Arc 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.")); + 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(), - res.getValue().nextLink(), - null)) + .>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 of the available Azure Data Services on Azure Arc 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 result of the request to list Azure Data Services on Azure Arc operations along with {@link - * PagedResponse} on successful completion of {@link Mono}. + * @return result of the request to list Azure Data Services on Azure Arc 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.")); + 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(), - res.getValue().nextLink(), - null)); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** * Lists all of the available Azure Data Services on Azure Arc 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 result of the request to list Azure Data Services on Azure Arc operations as paginated response with - * {@link PagedFlux}. + * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync() { @@ -157,27 +138,27 @@ private PagedFlux listAsync() { /** * Lists all of the available Azure Data Services on Azure Arc 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 result of the request to list Azure Data Services on Azure Arc operations as paginated response with - * {@link PagedFlux}. + * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Context context) { - return new PagedFlux<>( - () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); } /** * Lists all of the available Azure Data Services on Azure Arc 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 result of the request to list Azure Data Services on Azure Arc operations as paginated response with - * {@link PagedIterable}. + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { @@ -186,13 +167,13 @@ public PagedIterable list() { /** * Lists all of the available Azure Data Services on Azure Arc 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 result of the request to list Azure Data Services on Azure Arc operations as paginated response with - * {@link PagedIterable}. + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { @@ -201,14 +182,13 @@ public PagedIterable list(Context context) { /** * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Azure Data Services on Azure Arc operations along with {@link - * PagedResponse} on successful completion of {@link Mono}. + * @return result of the request to list Azure Data Services on Azure Arc operations along with + * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink) { @@ -216,37 +196,26 @@ private Mono> listNextSinglePageAsync(String nextL 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.")); + 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)) + 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 nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Azure Data Services on Azure Arc operations along with {@link - * PagedResponse} on successful completion of {@link Mono}. + * @return result of the request to list Azure Data Services on Azure Arc operations along with + * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink, Context context) { @@ -254,23 +223,13 @@ private Mono> listNextSinglePageAsync(String nextL 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.")); + 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)); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsImpl.java index c37fed4b74e2..88bda46dcd91 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsImpl.java @@ -19,20 +19,20 @@ public final class OperationsImpl implements Operations { private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; - public OperationsImpl( - OperationsClient innerClient, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager 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())); + return ResourceManagerUtils.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())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); } private OperationsClient serviceClient() { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstanceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstanceImpl.java new file mode 100644 index 000000000000..22b52de84fac --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstanceImpl.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.azurearcdata.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.PostgresInstanceInner; +import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstance; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceProperties; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSku; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceUpdate; +import java.util.Collections; +import java.util.Map; + +public final class PostgresInstanceImpl + implements PostgresInstance, PostgresInstance.Definition, PostgresInstance.Update { + private PostgresInstanceInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager 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 ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public PostgresInstanceProperties properties() { + return this.innerModel().properties(); + } + + public PostgresInstanceSku sku() { + return this.innerModel().sku(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PostgresInstanceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String postgresInstanceName; + + private PostgresInstanceUpdate updateParameters; + + public PostgresInstanceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public PostgresInstance create() { + this.innerObject = serviceManager.serviceClient() + .getPostgresInstances() + .create(resourceGroupName, postgresInstanceName, this.innerModel(), Context.NONE); + return this; + } + + public PostgresInstance create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPostgresInstances() + .create(resourceGroupName, postgresInstanceName, this.innerModel(), context); + return this; + } + + PostgresInstanceImpl(String name, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new PostgresInstanceInner(); + this.serviceManager = serviceManager; + this.postgresInstanceName = name; + } + + public PostgresInstanceImpl update() { + this.updateParameters = new PostgresInstanceUpdate(); + return this; + } + + public PostgresInstance apply() { + this.innerObject = serviceManager.serviceClient() + .getPostgresInstances() + .updateWithResponse(resourceGroupName, postgresInstanceName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public PostgresInstance apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPostgresInstances() + .updateWithResponse(resourceGroupName, postgresInstanceName, updateParameters, context) + .getValue(); + return this; + } + + PostgresInstanceImpl(PostgresInstanceInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.postgresInstanceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "postgresInstances"); + } + + public PostgresInstance refresh() { + this.innerObject = serviceManager.serviceClient() + .getPostgresInstances() + .getByResourceGroupWithResponse(resourceGroupName, postgresInstanceName, Context.NONE) + .getValue(); + return this; + } + + public PostgresInstance refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPostgresInstances() + .getByResourceGroupWithResponse(resourceGroupName, postgresInstanceName, context) + .getValue(); + return this; + } + + public PostgresInstanceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public PostgresInstanceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public PostgresInstanceImpl withProperties(PostgresInstanceProperties properties) { + if (isInCreateMode()) { + this.innerModel().withProperties(properties); + return this; + } else { + this.updateParameters.withProperties(properties); + return this; + } + } + + public PostgresInstanceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public PostgresInstanceImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public PostgresInstanceImpl withSku(PostgresInstanceSku sku) { + this.innerModel().withSku(sku); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesClientImpl.java new file mode 100644 index 000000000000..8e9077fa5222 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesClientImpl.java @@ -0,0 +1,1199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.PostgresInstanceInner; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceListResult; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceUpdate; +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 PostgresInstancesClient. + */ +public final class PostgresInstancesClientImpl implements PostgresInstancesClient { + /** + * The proxy service used to perform REST calls. + */ + private final PostgresInstancesService service; + + /** + * The service client containing this operation class. + */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of PostgresInstancesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PostgresInstancesClientImpl(AzureArcDataManagementClientImpl client) { + this.service + = RestProxy.create(PostgresInstancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientPostgresInstances to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureArcDataManageme") + public interface PostgresInstancesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/postgresInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("postgresInstanceName") String postgresInstanceName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("postgresInstanceName") String postgresInstanceName, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") PostgresInstanceInner resource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("postgresInstanceName") String postgresInstanceName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("postgresInstanceName") String postgresInstanceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PostgresInstanceUpdate parameters, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * List postgres Instance resources in the 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 PostgresInstance 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.getSubscriptionId(), + this.client.getApiVersion(), 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 postgres Instance resources in the 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 PostgresInstance 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.getSubscriptionId(), this.client.getApiVersion(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List postgres Instance resources in the 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 PostgresInstance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List postgres Instance resources in the 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 PostgresInstance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List postgres Instance resources in the 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 PostgresInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List postgres Instance resources in the 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 PostgresInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a postgres Instances list by Resource group name 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.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), 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 postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a postgres Instances list by Resource group name 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.getSubscriptionId(), resourceGroupName, + this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a postgres Instances list by Resource group name as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a postgres Instances list by Resource group name as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a postgres Instances list by Resource group name as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a postgres Instances list by Resource group name as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String postgresInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (postgresInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter postgresInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, postgresInstanceName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String postgresInstanceName, 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 (postgresInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter postgresInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + postgresInstanceName, this.client.getApiVersion(), accept, context); + } + + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String postgresInstanceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, postgresInstanceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String postgresInstanceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, postgresInstanceName, context).block(); + } + + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PostgresInstanceInner getByResourceGroup(String resourceGroupName, String postgresInstanceName) { + return getByResourceGroupWithResponse(resourceGroupName, postgresInstanceName, Context.NONE).getValue(); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, + String postgresInstanceName, PostgresInstanceInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (postgresInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter postgresInstanceName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, postgresInstanceName, this.client.getApiVersion(), resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, + String postgresInstanceName, PostgresInstanceInner resource, 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 (postgresInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter postgresInstanceName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + postgresInstanceName, this.client.getApiVersion(), resource, accept, context); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PostgresInstanceInner> + beginCreateAsync(String resourceGroupName, String postgresInstanceName, PostgresInstanceInner resource) { + Mono>> mono + = createWithResponseAsync(resourceGroupName, postgresInstanceName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PostgresInstanceInner.class, PostgresInstanceInner.class, + this.client.getContext()); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PostgresInstanceInner> beginCreateAsync( + String resourceGroupName, String postgresInstanceName, PostgresInstanceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createWithResponseAsync(resourceGroupName, postgresInstanceName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PostgresInstanceInner.class, PostgresInstanceInner.class, context); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PostgresInstanceInner> beginCreate(String resourceGroupName, + String postgresInstanceName, PostgresInstanceInner resource) { + return this.beginCreateAsync(resourceGroupName, postgresInstanceName, resource).getSyncPoller(); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PostgresInstanceInner> beginCreate(String resourceGroupName, + String postgresInstanceName, PostgresInstanceInner resource, Context context) { + return this.beginCreateAsync(resourceGroupName, postgresInstanceName, resource, context).getSyncPoller(); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String postgresInstanceName, + PostgresInstanceInner resource) { + return beginCreateAsync(resourceGroupName, postgresInstanceName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String postgresInstanceName, + PostgresInstanceInner resource, Context context) { + return beginCreateAsync(resourceGroupName, postgresInstanceName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PostgresInstanceInner create(String resourceGroupName, String postgresInstanceName, + PostgresInstanceInner resource) { + return createAsync(resourceGroupName, postgresInstanceName, resource).block(); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PostgresInstanceInner create(String resourceGroupName, String postgresInstanceName, + PostgresInstanceInner resource, Context context) { + return createAsync(resourceGroupName, postgresInstanceName, resource, context).block(); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 postgresInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (postgresInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter postgresInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, postgresInstanceName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 postgresInstanceName, 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 (postgresInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter postgresInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + postgresInstanceName, this.client.getApiVersion(), accept, context); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 postgresInstanceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, postgresInstanceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 postgresInstanceName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, postgresInstanceName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 postgresInstanceName) { + return this.beginDeleteAsync(resourceGroupName, postgresInstanceName).getSyncPoller(); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 postgresInstanceName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, postgresInstanceName, context).getSyncPoller(); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 postgresInstanceName) { + return beginDeleteAsync(resourceGroupName, postgresInstanceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 postgresInstanceName, Context context) { + return beginDeleteAsync(resourceGroupName, postgresInstanceName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 postgresInstanceName) { + deleteAsync(resourceGroupName, postgresInstanceName).block(); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 postgresInstanceName, Context context) { + deleteAsync(resourceGroupName, postgresInstanceName, context).block(); + } + + /** + * Updates a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param parameters The Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String postgresInstanceName, PostgresInstanceUpdate 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 (postgresInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter postgresInstanceName 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.getSubscriptionId(), + resourceGroupName, postgresInstanceName, this.client.getApiVersion(), parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param parameters The Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String postgresInstanceName, PostgresInstanceUpdate 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 (postgresInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter postgresInstanceName 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.getSubscriptionId(), resourceGroupName, + postgresInstanceName, this.client.getApiVersion(), parameters, accept, context); + } + + /** + * Updates a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param parameters The Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String postgresInstanceName, + PostgresInstanceUpdate parameters) { + return updateWithResponseAsync(resourceGroupName, postgresInstanceName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param parameters The Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String postgresInstanceName, + PostgresInstanceUpdate parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, postgresInstanceName, parameters, context).block(); + } + + /** + * Updates a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param parameters The Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PostgresInstanceInner update(String resourceGroupName, String postgresInstanceName, + PostgresInstanceUpdate parameters) { + return updateWithResponse(resourceGroupName, postgresInstanceName, parameters, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance 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/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesImpl.java new file mode 100644 index 000000000000..c337279a309e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesImpl.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.azurearcdata.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.azurearcdata.fluent.PostgresInstancesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.PostgresInstanceInner; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstance; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstances; + +public final class PostgresInstancesImpl implements PostgresInstances { + private static final ClientLogger LOGGER = new ClientLogger(PostgresInstancesImpl.class); + + private final PostgresInstancesClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public PostgresInstancesImpl(PostgresInstancesClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PostgresInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PostgresInstanceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PostgresInstanceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PostgresInstanceImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String postgresInstanceName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, postgresInstanceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PostgresInstanceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PostgresInstance getByResourceGroup(String resourceGroupName, String postgresInstanceName) { + PostgresInstanceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, postgresInstanceName); + if (inner != null) { + return new PostgresInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String postgresInstanceName) { + this.serviceClient().delete(resourceGroupName, postgresInstanceName); + } + + public void delete(String resourceGroupName, String postgresInstanceName, Context context) { + this.serviceClient().delete(resourceGroupName, postgresInstanceName, context); + } + + public PostgresInstance getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 postgresInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "postgresInstances"); + if (postgresInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'postgresInstances'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, postgresInstanceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 postgresInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "postgresInstances"); + if (postgresInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'postgresInstances'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, postgresInstanceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.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 postgresInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "postgresInstances"); + if (postgresInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'postgresInstances'.", id))); + } + this.delete(resourceGroupName, postgresInstanceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 postgresInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "postgresInstances"); + if (postgresInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'postgresInstances'.", id))); + } + this.delete(resourceGroupName, postgresInstanceName, context); + } + + private PostgresInstancesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public PostgresInstanceImpl define(String name) { + return new PostgresInstanceImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/Utils.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ResourceManagerUtils.java similarity index 79% rename from sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/Utils.java rename to sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ResourceManagerUtils.java index 415d85cc0e6a..a2c6f5fdb2a4 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/Utils.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ResourceManagerUtils.java @@ -19,7 +19,10 @@ import java.util.stream.Stream; import reactor.core.publisher.Flux; -final class Utils { +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + static String getValueFromIdByName(String id, String name) { if (id == null) { return null; @@ -60,7 +63,7 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri segments.add(idSegment); idItrReverted.forEachRemaining(segments::add); Collections.reverse(segments); - if (segments.size() > 0 && segments.get(0).isEmpty()) { + if (!segments.isEmpty() && segments.get(0).isEmpty()) { segments.remove(0); } return String.join("/", segments); @@ -74,7 +77,7 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri } static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl(pageIterable, mapper); + return new PagedIterableImpl<>(pageIterable, mapper); } private static final class PagedIterableImpl extends PagedIterable { @@ -84,26 +87,17 @@ private static final class PagedIterableImpl extends PagedIterable { private final Function, PagedResponse> pageMapper; private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { - super( - PagedFlux - .create( - () -> - (continuationToken, pageSize) -> - Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(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); + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); } @Override @@ -133,30 +127,27 @@ public Stream> streamByPage(String continuationToken, int prefe @Override public Iterator iterator() { - return new IteratorImpl(pagedIterable.iterator(), mapper); + return new IteratorImpl<>(pagedIterable.iterator(), mapper); } @Override public Iterable> iterableByPage() { - return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); } @Override public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl, PagedResponse>( - pagedIterable.iterableByPage(continuationToken), pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); } @Override public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl, PagedResponse>( - pagedIterable.iterableByPage(preferredPageSize), pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); } @Override public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl, PagedResponse>( - pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); } } @@ -198,7 +189,7 @@ private IterableImpl(Iterable iterable, Function mapper) { @Override public Iterator iterator() { - return new IteratorImpl(iterable.iterator(), mapper); + return new IteratorImpl<>(iterable.iterator(), mapper); } } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstanceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstanceImpl.java index 43d8e92454e2..406eed3fd89a 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstanceImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstanceImpl.java @@ -95,20 +95,16 @@ public SqlManagedInstanceImpl withExistingResourceGroup(String resourceGroupName } public SqlManagedInstance create() { - this.innerObject = - serviceManager - .serviceClient() - .getSqlManagedInstances() - .create(resourceGroupName, sqlManagedInstanceName, this.innerModel(), Context.NONE); + this.innerObject = serviceManager.serviceClient() + .getSqlManagedInstances() + .create(resourceGroupName, sqlManagedInstanceName, this.innerModel(), Context.NONE); return this; } public SqlManagedInstance create(Context context) { - this.innerObject = - serviceManager - .serviceClient() - .getSqlManagedInstances() - .create(resourceGroupName, sqlManagedInstanceName, this.innerModel(), context); + this.innerObject = serviceManager.serviceClient() + .getSqlManagedInstances() + .create(resourceGroupName, sqlManagedInstanceName, this.innerModel(), context); return this; } @@ -124,51 +120,43 @@ public SqlManagedInstanceImpl update() { } public SqlManagedInstance apply() { - this.innerObject = - serviceManager - .serviceClient() - .getSqlManagedInstances() - .updateWithResponse(resourceGroupName, sqlManagedInstanceName, updateParameters, Context.NONE) - .getValue(); + this.innerObject = serviceManager.serviceClient() + .getSqlManagedInstances() + .updateWithResponse(resourceGroupName, sqlManagedInstanceName, updateParameters, Context.NONE) + .getValue(); return this; } public SqlManagedInstance apply(Context context) { - this.innerObject = - serviceManager - .serviceClient() - .getSqlManagedInstances() - .updateWithResponse(resourceGroupName, sqlManagedInstanceName, updateParameters, context) - .getValue(); + this.innerObject = serviceManager.serviceClient() + .getSqlManagedInstances() + .updateWithResponse(resourceGroupName, sqlManagedInstanceName, updateParameters, context) + .getValue(); return this; } - SqlManagedInstanceImpl( - SqlManagedInstanceInner innerObject, + SqlManagedInstanceImpl(SqlManagedInstanceInner innerObject, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; - this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.sqlManagedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "sqlManagedInstances"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.sqlManagedInstanceName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlManagedInstances"); } public SqlManagedInstance refresh() { - this.innerObject = - serviceManager - .serviceClient() - .getSqlManagedInstances() - .getByResourceGroupWithResponse(resourceGroupName, sqlManagedInstanceName, Context.NONE) - .getValue(); + this.innerObject = serviceManager.serviceClient() + .getSqlManagedInstances() + .getByResourceGroupWithResponse(resourceGroupName, sqlManagedInstanceName, Context.NONE) + .getValue(); return this; } public SqlManagedInstance refresh(Context context) { - this.innerObject = - serviceManager - .serviceClient() - .getSqlManagedInstances() - .getByResourceGroupWithResponse(resourceGroupName, sqlManagedInstanceName, context) - .getValue(); + this.innerObject = serviceManager.serviceClient() + .getSqlManagedInstances() + .getByResourceGroupWithResponse(resourceGroupName, sqlManagedInstanceName, context) + .getValue(); return this; } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesClientImpl.java index c79940fd8b3c..36a51c6cb80a 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesClientImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesClientImpl.java @@ -40,22 +40,28 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in SqlManagedInstancesClient. */ +/** + * An instance of this class provides access to all the operations defined in SqlManagedInstancesClient. + */ public final class SqlManagedInstancesClientImpl implements SqlManagedInstancesClient { - /** The proxy service used to perform REST calls. */ + /** + * The proxy service used to perform REST calls. + */ private final SqlManagedInstancesService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final AzureArcDataManagementClientImpl client; /** * Initializes an instance of SqlManagedInstancesClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ SqlManagedInstancesClientImpl(AzureArcDataManagementClientImpl client) { - this.service = - RestProxy.create(SqlManagedInstancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.service = RestProxy.create(SqlManagedInstancesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); this.client = client; } @@ -66,117 +72,87 @@ public final class SqlManagedInstancesClientImpl implements SqlManagedInstancesC @Host("{$host}") @ServiceInterface(name = "AzureArcDataManageme") public interface SqlManagedInstancesService { - @Headers({"Content-Type: application/json"}) + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlManagedInstances") - @ExpectedResponses({200}) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list( - @HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlManagedInstances") - @ExpectedResponses({200}) + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup( - @HostParam("$host") String endpoint, + Mono> listByResourceGroup(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlManagedInstances/{sqlManagedInstanceName}") - @ExpectedResponses({200}) + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup( - @HostParam("$host") String endpoint, + Mono> getByResourceGroup(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, - @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlManagedInstances/{sqlManagedInstanceName}") - @ExpectedResponses({200, 201}) + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") + @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> create( - @HostParam("$host") String endpoint, + Mono>> create(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, @QueryParam("api-version") String apiVersion, @BodyParam("application/json") SqlManagedInstanceInner sqlManagedInstance, - @HeaderParam("Accept") String accept, - Context context); + @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlManagedInstances/{sqlManagedInstanceName}") - @ExpectedResponses({200, 202, 204}) + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") + @ExpectedResponses({ 200, 202, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete( - @HostParam("$host") String endpoint, + Mono>> delete(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, - @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlManagedInstances/{sqlManagedInstanceName}") - @ExpectedResponses({200}) + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update( - @HostParam("$host") String endpoint, + Mono> update(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") SqlManagedInstanceUpdate parameters, - @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlManagedInstanceUpdate parameters, @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") - @ExpectedResponses({200}) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") - @ExpectedResponses({200}) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** * List sqlManagedInstance resources in the 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 SqlManagedInstance along with {@link PagedResponse} on successful completion of {@link Mono}. @@ -184,43 +160,25 @@ Mono> listByResourceGroupNext( @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.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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.getSubscriptionId(), - this.client.getApiVersion(), - accept, - context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getApiVersion(), 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 sqlManagedInstance resources in the 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. @@ -230,40 +188,25 @@ private Mono> listSinglePageAsync() { @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.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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.getSubscriptionId(), - this.client.getApiVersion(), - accept, + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** * List sqlManagedInstance resources in the 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 SqlManagedInstance as paginated response with {@link PagedFlux}. @@ -275,7 +218,7 @@ private PagedFlux listAsync() { /** * List sqlManagedInstance resources in the 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. @@ -284,13 +227,13 @@ private PagedFlux listAsync() { */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Context context) { - return new PagedFlux<>( - () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); } /** * List sqlManagedInstance resources in the 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 SqlManagedInstance as paginated response with {@link PagedIterable}. @@ -302,7 +245,7 @@ public PagedIterable list() { /** * List sqlManagedInstance resources in the 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. @@ -316,29 +259,25 @@ public PagedIterable list(Context context) { /** * List sqlManagedInstance resources in the resource group - * - *

Gets all sqlManagedInstances in a resource group. - * + * + * Gets all sqlManagedInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all sqlManagedInstances in a resource group along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@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.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -346,55 +285,36 @@ private Mono> listByResourceGroupSinglePa } final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service - .listByResourceGroup( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - this.client.getApiVersion(), - accept, - context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), 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 sqlManagedInstance resources in the resource group - * - *

Gets all sqlManagedInstances in a resource group. - * + * + * Gets all sqlManagedInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all sqlManagedInstances in a resource group along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync( - String resourceGroupName, Context context) { + 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.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -403,29 +323,17 @@ private Mono> listByResourceGroupSinglePa final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listByResourceGroup( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - this.client.getApiVersion(), - accept, - context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + .listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** * List sqlManagedInstance resources in the resource group - * - *

Gets all sqlManagedInstances in a resource group. - * + * + * Gets all sqlManagedInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -434,16 +342,15 @@ private Mono> listByResourceGroupSinglePa */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>( - () -> listByResourceGroupSinglePageAsync(resourceGroupName), + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** * List sqlManagedInstance resources in the resource group - * - *

Gets all sqlManagedInstances in a resource group. - * + * + * Gets all sqlManagedInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -453,16 +360,15 @@ private PagedFlux listByResourceGroupAsync(String resou */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>( - () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); } /** * List sqlManagedInstance resources in the resource group - * - *

Gets all sqlManagedInstances in a resource group. - * + * + * Gets all sqlManagedInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -476,9 +382,9 @@ public PagedIterable listByResourceGroup(String resourc /** * List sqlManagedInstance resources in the resource group - * - *

Gets all sqlManagedInstances in a resource group. - * + * + * Gets all sqlManagedInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -493,7 +399,7 @@ public PagedIterable listByResourceGroup(String resourc /** * Retrieves a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -502,48 +408,35 @@ public PagedIterable listByResourceGroup(String resourc * @return a SqlManagedInstance along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync( - String resourceGroupName, String sqlManagedInstanceName) { + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (sqlManagedInstanceName == null) { - return Mono - .error( - new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( - context -> - service - .getByResourceGroup( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - sqlManagedInstanceName, - this.client.getApiVersion(), - accept, - context)) + context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlManagedInstanceName, this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Retrieves a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. @@ -553,45 +446,33 @@ private Mono> getByResourceGroupWithResponseAs * @return a SqlManagedInstance along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync( - String resourceGroupName, String sqlManagedInstanceName, Context context) { + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName, Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (sqlManagedInstanceName == null) { - return Mono - .error( - new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .getByResourceGroup( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - sqlManagedInstanceName, - this.client.getApiVersion(), - accept, - context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlManagedInstanceName, this.client.getApiVersion(), accept, context); } /** * Retrieves a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -600,15 +481,15 @@ private Mono> getByResourceGroupWithResponseAs * @return a SqlManagedInstance on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync( - String resourceGroupName, String sqlManagedInstanceName) { + private Mono getByResourceGroupAsync(String resourceGroupName, + String sqlManagedInstanceName) { return getByResourceGroupWithResponseAsync(resourceGroupName, sqlManagedInstanceName) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Retrieves a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. @@ -618,14 +499,14 @@ private Mono getByResourceGroupAsync( * @return a SqlManagedInstance along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse( - String resourceGroupName, String sqlManagedInstanceName, Context context) { + public Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlManagedInstanceName, Context context) { return getByResourceGroupWithResponseAsync(resourceGroupName, sqlManagedInstanceName, context).block(); } /** * Retrieves a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -640,9 +521,9 @@ public SqlManagedInstanceInner getByResourceGroup(String resourceGroupName, Stri /** * Creates or replaces a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -650,28 +531,23 @@ public SqlManagedInstanceInner getByResourceGroup(String resourceGroupName, Stri * @return a SqlManagedInstance along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createWithResponseAsync( - String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance) { + private Mono>> createWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (sqlManagedInstanceName == null) { - return Mono - .error( - new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); } if (sqlManagedInstance == null) { return Mono @@ -682,25 +558,16 @@ private Mono>> createWithResponseAsync( final String accept = "application/json"; return FluxUtil .withContext( - context -> - service - .create( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - sqlManagedInstanceName, - this.client.getApiVersion(), - sqlManagedInstance, - accept, - context)) + context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlManagedInstanceName, this.client.getApiVersion(), sqlManagedInstance, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Creates or replaces a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -709,31 +576,23 @@ private Mono>> createWithResponseAsync( * @return a SqlManagedInstance along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createWithResponseAsync( - String resourceGroupName, - String sqlManagedInstanceName, - SqlManagedInstanceInner sqlManagedInstance, - Context context) { + private Mono>> createWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance, Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (sqlManagedInstanceName == null) { - return Mono - .error( - new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); } if (sqlManagedInstance == null) { return Mono @@ -743,23 +602,15 @@ private Mono>> createWithResponseAsync( } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .create( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - sqlManagedInstanceName, - this.client.getApiVersion(), - sqlManagedInstance, - accept, - context); + return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlManagedInstanceName, this.client.getApiVersion(), sqlManagedInstance, accept, context); } /** * Creates or replaces a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -769,23 +620,18 @@ private Mono>> createWithResponseAsync( @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, SqlManagedInstanceInner> beginCreateAsync( String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance) { - Mono>> mono = - createWithResponseAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance); - return this - .client - .getLroResult( - mono, - this.client.getHttpPipeline(), - SqlManagedInstanceInner.class, - SqlManagedInstanceInner.class, - this.client.getContext()); + Mono>> mono + = createWithResponseAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SqlManagedInstanceInner.class, SqlManagedInstanceInner.class, + this.client.getContext()); } /** * Creates or replaces a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -795,28 +641,20 @@ private PollerFlux, SqlManagedInstanceInner> */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, SqlManagedInstanceInner> beginCreateAsync( - String resourceGroupName, - String sqlManagedInstanceName, - SqlManagedInstanceInner sqlManagedInstance, + String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance, Context context) { context = this.client.mergeContext(context); - Mono>> mono = - createWithResponseAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, context); - return this - .client - .getLroResult( - mono, - this.client.getHttpPipeline(), - SqlManagedInstanceInner.class, - SqlManagedInstanceInner.class, - context); + Mono>> mono + = createWithResponseAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SqlManagedInstanceInner.class, SqlManagedInstanceInner.class, context); } /** * Creates or replaces a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -831,9 +669,9 @@ public SyncPoller, SqlManagedInstanceInner> /** * Creates or replaces a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -843,20 +681,17 @@ public SyncPoller, SqlManagedInstanceInner> */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, SqlManagedInstanceInner> beginCreate( - String resourceGroupName, - String sqlManagedInstanceName, - SqlManagedInstanceInner sqlManagedInstance, + String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance, Context context) { - return this - .beginCreateAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, context) + return this.beginCreateAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, context) .getSyncPoller(); } /** * Creates or replaces a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -864,18 +699,17 @@ public SyncPoller, SqlManagedInstanceInner> * @return a SqlManagedInstance on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync( - String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance) { - return beginCreateAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance) - .last() + private Mono createAsync(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceInner sqlManagedInstance) { + return beginCreateAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance).last() .flatMap(this.client::getLroFinalResultOrError); } /** * Creates or replaces a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -884,21 +718,17 @@ private Mono createAsync( * @return a SqlManagedInstance on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync( - String resourceGroupName, - String sqlManagedInstanceName, - SqlManagedInstanceInner sqlManagedInstance, - Context context) { - return beginCreateAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, context) - .last() + private Mono createAsync(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceInner sqlManagedInstance, Context context) { + return beginCreateAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, context).last() .flatMap(this.client::getLroFinalResultOrError); } /** * Creates or replaces a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -906,16 +736,16 @@ private Mono createAsync( * @return a SqlManagedInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SqlManagedInstanceInner create( - String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance) { + public SqlManagedInstanceInner create(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceInner sqlManagedInstance) { return createAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance).block(); } /** * Creates or replaces a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -924,69 +754,52 @@ public SqlManagedInstanceInner create( * @return a SqlManagedInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SqlManagedInstanceInner create( - String resourceGroupName, - String sqlManagedInstanceName, - SqlManagedInstanceInner sqlManagedInstance, - Context context) { + public SqlManagedInstanceInner create(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceInner sqlManagedInstance, Context context) { return createAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, context).block(); } /** * Deletes a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 sqlManagedInstanceName) { + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (sqlManagedInstanceName == null) { - return Mono - .error( - new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service - .delete( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - sqlManagedInstanceName, - this.client.getApiVersion(), - accept, - context)) + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlManagedInstanceName, this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Deletes a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -994,67 +807,53 @@ private Mono>> deleteWithResponseAsync( * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync( - String resourceGroupName, String sqlManagedInstanceName, Context context) { + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName, Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (sqlManagedInstanceName == null) { - return Mono - .error( - new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .delete( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - sqlManagedInstanceName, - this.client.getApiVersion(), - accept, - context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlManagedInstanceName, this.client.getApiVersion(), accept, context); } /** * Deletes a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 sqlManagedInstanceName) { + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String sqlManagedInstanceName) { Mono>> mono = deleteWithResponseAsync(resourceGroupName, sqlManagedInstanceName); - return this - .client - .getLroResult( - mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); } /** * Deletes a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1062,21 +861,20 @@ private PollerFlux, Void> beginDeleteAsync( * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync( - String resourceGroupName, String sqlManagedInstanceName, Context context) { + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String sqlManagedInstanceName, + Context context) { context = this.client.mergeContext(context); - Mono>> mono = - deleteWithResponseAsync(resourceGroupName, sqlManagedInstanceName, context); - return this - .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, sqlManagedInstanceName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); } /** * Deletes a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1089,9 +887,9 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, /** * Deletes a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1099,16 +897,16 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete( - String resourceGroupName, String sqlManagedInstanceName, Context context) { + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlManagedInstanceName, + Context context) { return this.beginDeleteAsync(resourceGroupName, sqlManagedInstanceName, context).getSyncPoller(); } /** * Deletes a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1116,16 +914,15 @@ public SyncPoller, Void> beginDelete( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String sqlManagedInstanceName) { - return beginDeleteAsync(resourceGroupName, sqlManagedInstanceName) - .last() + return beginDeleteAsync(resourceGroupName, sqlManagedInstanceName).last() .flatMap(this.client::getLroFinalResultOrError); } /** * Deletes a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1134,16 +931,15 @@ private Mono deleteAsync(String resourceGroupName, String sqlManagedInstan */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String sqlManagedInstanceName, Context context) { - return beginDeleteAsync(resourceGroupName, sqlManagedInstanceName, context) - .last() + return beginDeleteAsync(resourceGroupName, sqlManagedInstanceName, context).last() .flatMap(this.client::getLroFinalResultOrError); } /** * Deletes a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1155,9 +951,9 @@ public void delete(String resourceGroupName, String sqlManagedInstanceName) { /** * Deletes a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1170,9 +966,9 @@ public void delete(String resourceGroupName, String sqlManagedInstanceName, Cont /** * Updates a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of sqlManagedInstance. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param parameters The SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1180,28 +976,23 @@ public void delete(String resourceGroupName, String sqlManagedInstanceName, Cont * @return a SqlManagedInstance along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( - String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceUpdate parameters) { + private Mono> updateWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName, SqlManagedInstanceUpdate parameters) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (sqlManagedInstanceName == null) { - return Mono - .error( - new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); } if (parameters == null) { return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); @@ -1210,26 +1001,16 @@ private Mono> updateWithResponseAsync( } final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service - .update( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - sqlManagedInstanceName, - this.client.getApiVersion(), - parameters, - accept, - context)) + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlManagedInstanceName, this.client.getApiVersion(), parameters, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Updates a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of sqlManagedInstance. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param parameters The SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1238,28 +1019,23 @@ private Mono> updateWithResponseAsync( * @return a SqlManagedInstance along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( - String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceUpdate parameters, Context context) { + private Mono> updateWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName, SqlManagedInstanceUpdate parameters, Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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 (sqlManagedInstanceName == null) { - return Mono - .error( - new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); } if (parameters == null) { return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); @@ -1268,23 +1044,15 @@ private Mono> updateWithResponseAsync( } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .update( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - sqlManagedInstanceName, - this.client.getApiVersion(), - parameters, - accept, - context); + return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlManagedInstanceName, this.client.getApiVersion(), parameters, accept, context); } /** * Updates a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of sqlManagedInstance. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param parameters The SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1292,17 +1060,17 @@ private Mono> updateWithResponseAsync( * @return a SqlManagedInstance on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync( - String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceUpdate parameters) { + private Mono updateAsync(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceUpdate parameters) { return updateWithResponseAsync(resourceGroupName, sqlManagedInstanceName, parameters) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Updates a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of sqlManagedInstance. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param parameters The SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1311,16 +1079,16 @@ private Mono updateAsync( * @return a SqlManagedInstance along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse( - String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceUpdate parameters, Context context) { + public Response updateWithResponse(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceUpdate parameters, Context context) { return updateWithResponseAsync(resourceGroupName, sqlManagedInstanceName, parameters, context).block(); } /** * Updates a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of sqlManagedInstance. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param parameters The SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1328,16 +1096,15 @@ public Response updateWithResponse( * @return a SqlManagedInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SqlManagedInstanceInner update( - String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceUpdate parameters) { + public SqlManagedInstanceInner update(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceUpdate parameters) { return updateWithResponse(resourceGroupName, sqlManagedInstanceName, parameters, Context.NONE).getValue(); } /** * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1349,31 +1116,20 @@ private Mono> listNextSinglePageAsync(Str 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.")); + 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)) + 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 nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1386,31 +1142,20 @@ private Mono> listNextSinglePageAsync(Str 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.")); + 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)); + 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. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1422,32 +1167,22 @@ private Mono> listByResourceGroupNextSing 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.")); + 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)) + .>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 nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1455,29 +1190,19 @@ private Mono> listByResourceGroupNextSing * @return a list of SqlManagedInstance along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync( - String nextLink, Context context) { + 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.")); + 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)); + 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/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesImpl.java index 306c892930e6..374eafb81e53 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesImpl.java @@ -21,8 +21,7 @@ public final class SqlManagedInstancesImpl implements SqlManagedInstances { private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; - public SqlManagedInstancesImpl( - SqlManagedInstancesClient innerClient, + public SqlManagedInstancesImpl(SqlManagedInstancesClient innerClient, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; @@ -30,34 +29,31 @@ public SqlManagedInstancesImpl( public PagedIterable list() { PagedIterable inner = this.serviceClient().list(); - return Utils.mapPage(inner, inner1 -> new SqlManagedInstanceImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlManagedInstanceImpl(inner1, this.manager())); } public PagedIterable list(Context context) { PagedIterable inner = this.serviceClient().list(context); - return Utils.mapPage(inner, inner1 -> new SqlManagedInstanceImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlManagedInstanceImpl(inner1, this.manager())); } public PagedIterable listByResourceGroup(String resourceGroupName) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return Utils.mapPage(inner, inner1 -> new SqlManagedInstanceImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlManagedInstanceImpl(inner1, this.manager())); } public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - PagedIterable inner = - this.serviceClient().listByResourceGroup(resourceGroupName, context); - return Utils.mapPage(inner, inner1 -> new SqlManagedInstanceImpl(inner1, this.manager())); + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlManagedInstanceImpl(inner1, this.manager())); } - public Response getByResourceGroupWithResponse( - String resourceGroupName, String sqlManagedInstanceName, Context context) { - Response inner = - this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, sqlManagedInstanceName, context); + public Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlManagedInstanceName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, sqlManagedInstanceName, context); if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), new SqlManagedInstanceImpl(inner.getValue(), this.manager())); } else { return null; @@ -65,8 +61,8 @@ public Response getByResourceGroupWithResponse( } public SqlManagedInstance getByResourceGroup(String resourceGroupName, String sqlManagedInstanceName) { - SqlManagedInstanceInner inner = - this.serviceClient().getByResourceGroup(resourceGroupName, sqlManagedInstanceName); + SqlManagedInstanceInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, sqlManagedInstanceName); if (inner != null) { return new SqlManagedInstanceImpl(inner, this.manager()); } else { @@ -83,85 +79,57 @@ public void delete(String resourceGroupName, String sqlManagedInstanceName, Cont } public SqlManagedInstance getById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.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))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String sqlManagedInstanceName = Utils.getValueFromIdByName(id, "sqlManagedInstances"); + String sqlManagedInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlManagedInstances"); if (sqlManagedInstanceName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format( - "The resource ID '%s' is not valid. Missing path segment 'sqlManagedInstances'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlManagedInstances'.", id))); } return this.getByResourceGroupWithResponse(resourceGroupName, sqlManagedInstanceName, Context.NONE).getValue(); } public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.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))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String sqlManagedInstanceName = Utils.getValueFromIdByName(id, "sqlManagedInstances"); + String sqlManagedInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlManagedInstances"); if (sqlManagedInstanceName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format( - "The resource ID '%s' is not valid. Missing path segment 'sqlManagedInstances'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlManagedInstances'.", id))); } return this.getByResourceGroupWithResponse(resourceGroupName, sqlManagedInstanceName, context); } public void deleteById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.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))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String sqlManagedInstanceName = Utils.getValueFromIdByName(id, "sqlManagedInstances"); + String sqlManagedInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlManagedInstances"); if (sqlManagedInstanceName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format( - "The resource ID '%s' is not valid. Missing path segment 'sqlManagedInstances'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlManagedInstances'.", id))); } this.delete(resourceGroupName, sqlManagedInstanceName, Context.NONE); } public void deleteByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.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))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String sqlManagedInstanceName = Utils.getValueFromIdByName(id, "sqlManagedInstances"); + String sqlManagedInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlManagedInstances"); if (sqlManagedInstanceName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format( - "The resource ID '%s' is not valid. Missing path segment 'sqlManagedInstances'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlManagedInstances'.", id))); } this.delete(resourceGroupName, sqlManagedInstanceName, context); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupResourceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupResourceImpl.java new file mode 100644 index 000000000000..8910feebb235 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupResourceImpl.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.Databases; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupUpdate; +import java.util.Collections; +import java.util.Map; + +public final class SqlServerAvailabilityGroupResourceImpl implements SqlServerAvailabilityGroupResource, + SqlServerAvailabilityGroupResource.Definition, SqlServerAvailabilityGroupResource.Update { + private SqlServerAvailabilityGroupResourceInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager 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 SqlServerAvailabilityGroupResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SqlServerAvailabilityGroupResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sqlServerInstanceName; + + private String availabilityGroupName; + + private SqlServerAvailabilityGroupUpdate updateSqlServerAvailabilityGroupUpdate; + + public SqlServerAvailabilityGroupResourceImpl withExistingSqlServerInstance(String resourceGroupName, + String sqlServerInstanceName) { + this.resourceGroupName = resourceGroupName; + this.sqlServerInstanceName = sqlServerInstanceName; + return this; + } + + public SqlServerAvailabilityGroupResource create() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerAvailabilityGroups() + .createWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public SqlServerAvailabilityGroupResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerAvailabilityGroups() + .createWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, this.innerModel(), + context) + .getValue(); + return this; + } + + SqlServerAvailabilityGroupResourceImpl(String name, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new SqlServerAvailabilityGroupResourceInner(); + this.serviceManager = serviceManager; + this.availabilityGroupName = name; + } + + public SqlServerAvailabilityGroupResourceImpl update() { + this.updateSqlServerAvailabilityGroupUpdate = new SqlServerAvailabilityGroupUpdate(); + return this; + } + + public SqlServerAvailabilityGroupResource apply() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerAvailabilityGroups() + .update(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + updateSqlServerAvailabilityGroupUpdate, Context.NONE); + return this; + } + + public SqlServerAvailabilityGroupResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerAvailabilityGroups() + .update(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + updateSqlServerAvailabilityGroupUpdate, context); + return this; + } + + SqlServerAvailabilityGroupResourceImpl(SqlServerAvailabilityGroupResourceInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlServerInstances"); + this.availabilityGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "availabilityGroups"); + } + + public SqlServerAvailabilityGroupResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerAvailabilityGroups() + .getWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, Context.NONE) + .getValue(); + return this; + } + + public SqlServerAvailabilityGroupResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerAvailabilityGroups() + .getWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context) + .getValue(); + return this; + } + + public Response detailViewWithResponse(Context context) { + return serviceManager.sqlServerAvailabilityGroups() + .detailViewWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + } + + public SqlServerAvailabilityGroupResource detailView() { + return serviceManager.sqlServerAvailabilityGroups() + .detailView(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + } + + public Response failoverWithResponse(Context context) { + return serviceManager.sqlServerAvailabilityGroups() + .failoverWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + } + + public SqlServerAvailabilityGroupResource failover() { + return serviceManager.sqlServerAvailabilityGroups() + .failover(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + } + + public Response forceFailoverAllowDataLossWithResponse(Context context) { + return serviceManager.sqlServerAvailabilityGroups() + .forceFailoverAllowDataLossWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + context); + } + + public SqlServerAvailabilityGroupResource forceFailoverAllowDataLoss() { + return serviceManager.sqlServerAvailabilityGroups() + .forceFailoverAllowDataLoss(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + } + + public Response addDatabasesWithResponse(Databases databases, Context context) { + return serviceManager.sqlServerAvailabilityGroups() + .addDatabasesWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases, + context); + } + + public SqlServerAvailabilityGroupResource addDatabases(Databases databases) { + return serviceManager.sqlServerAvailabilityGroups() + .addDatabases(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases); + } + + public Response removeDatabasesWithResponse(Databases databases, + Context context) { + return serviceManager.sqlServerAvailabilityGroups() + .removeDatabasesWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases, + context); + } + + public SqlServerAvailabilityGroupResource removeDatabases(Databases databases) { + return serviceManager.sqlServerAvailabilityGroups() + .removeDatabases(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases); + } + + public SqlServerAvailabilityGroupResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SqlServerAvailabilityGroupResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SqlServerAvailabilityGroupResourceImpl + withProperties(SqlServerAvailabilityGroupResourceProperties properties) { + if (isInCreateMode()) { + this.innerModel().withProperties(properties); + return this; + } else { + this.updateSqlServerAvailabilityGroupUpdate.withProperties(properties); + return this; + } + } + + public SqlServerAvailabilityGroupResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateSqlServerAvailabilityGroupUpdate.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsClientImpl.java new file mode 100644 index 000000000000..1fff4e3f3293 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsClientImpl.java @@ -0,0 +1,2465 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.azurearcdata.fluent.SqlServerAvailabilityGroupsClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityGroupListResult; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.Databases; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupUpdate; +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 SqlServerAvailabilityGroupsClient. + */ +public final class SqlServerAvailabilityGroupsClientImpl implements SqlServerAvailabilityGroupsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SqlServerAvailabilityGroupsService service; + + /** + * The service client containing this operation class. + */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of SqlServerAvailabilityGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlServerAvailabilityGroupsClientImpl(AzureArcDataManagementClientImpl client) { + this.service = RestProxy.create(SqlServerAvailabilityGroupsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientSqlServerAvailabilityGroups to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureArcDataManageme") + public interface SqlServerAvailabilityGroupsService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/getDetailView") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> detailView(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/failover") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> failover(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/forceFailoverAllowDataLoss") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> forceFailoverAllowDataLoss( + @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/createAvailabilityGroup") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createAvailabilityGroup(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/createDistributedAvailabilityGroup") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createDistributedAvailabilityGroup(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/addDatabases") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> addDatabases(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") Databases databases, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/removeDatabases") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> removeDatabases(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") Databases databases, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group 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 arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + if (sqlServerAvailabilityGroupResource == null) { + return Mono.error(new IllegalArgumentException( + "Parameter sqlServerAvailabilityGroupResource is required and cannot be null.")); + } else { + sqlServerAvailabilityGroupResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), + sqlServerAvailabilityGroupResource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group 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 arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource, 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + if (sqlServerAvailabilityGroupResource == null) { + return Mono.error(new IllegalArgumentException( + "Parameter sqlServerAvailabilityGroupResource is required and cannot be null.")); + } else { + sqlServerAvailabilityGroupResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), + sqlServerAvailabilityGroupResource, accept, context); + } + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group 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 arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource) { + return createWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + sqlServerAvailabilityGroupResource).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group 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 arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource, Context context) { + return createWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + sqlServerAvailabilityGroupResource, context).block(); + } + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group 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 arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner create(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource) { + return createWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + sqlServerAvailabilityGroupResource, Context.NONE).getValue(); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), accept, context); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + return this.beginDeleteAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName).getSyncPoller(); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Context context) { + return this.beginDeleteAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context) + .getSyncPoller(); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + return beginDeleteAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + Context context) { + return beginDeleteAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName) { + deleteAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName).block(); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + Context context) { + deleteAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context).block(); + } + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), accept, context); + } + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + return getWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context).block(); + } + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner get(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + return getWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, Context.NONE) + .getValue(); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + if (sqlServerAvailabilityGroupUpdate == null) { + return Mono.error(new IllegalArgumentException( + "Parameter sqlServerAvailabilityGroupUpdate is required and cannot be null.")); + } else { + sqlServerAvailabilityGroupUpdate.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), + sqlServerAvailabilityGroupUpdate, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + if (sqlServerAvailabilityGroupUpdate == null) { + return Mono.error(new IllegalArgumentException( + "Parameter sqlServerAvailabilityGroupUpdate is required and cannot be null.")); + } else { + sqlServerAvailabilityGroupUpdate.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), sqlServerAvailabilityGroupUpdate, + accept, context); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerAvailabilityGroupResourceInner> + beginUpdateAsync(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, sqlServerInstanceName, + availabilityGroupName, sqlServerAvailabilityGroupUpdate); + return this.client + .getLroResult(mono, + this.client.getHttpPipeline(), SqlServerAvailabilityGroupResourceInner.class, + SqlServerAvailabilityGroupResourceInner.class, this.client.getContext()); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerAvailabilityGroupResourceInner> + beginUpdateAsync(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(resourceGroupName, sqlServerInstanceName, + availabilityGroupName, sqlServerAvailabilityGroupUpdate, context); + return this.client + .getLroResult(mono, + this.client.getHttpPipeline(), SqlServerAvailabilityGroupResourceInner.class, + SqlServerAvailabilityGroupResourceInner.class, context); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginUpdate(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate) { + return this + .beginUpdateAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + sqlServerAvailabilityGroupUpdate) + .getSyncPoller(); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginUpdate(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, Context context) { + return this + .beginUpdateAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + sqlServerAvailabilityGroupUpdate, context) + .getSyncPoller(); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate) { + return beginUpdateAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + sqlServerAvailabilityGroupUpdate).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, Context context) { + return beginUpdateAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + sqlServerAvailabilityGroupUpdate, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner update(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate) { + return updateAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + sqlServerAvailabilityGroupUpdate).block(); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner update(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, + Context context) { + return updateAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + sqlServerAvailabilityGroupUpdate, context).block(); + } + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> detailViewWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.detailView(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> detailViewWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.detailView(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), accept, context); + } + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono detailViewAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + return detailViewWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response detailViewWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context) { + return detailViewWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context) + .block(); + } + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner detailView(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + return detailViewWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, Context.NONE) + .getValue(); + } + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> failoverWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.failover(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> failoverWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.failover(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), accept, context); + } + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + return failoverWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response failoverWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context) { + return failoverWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context) + .block(); + } + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner failover(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + return failoverWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, Context.NONE) + .getValue(); + } + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> forceFailoverAllowDataLossWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.forceFailoverAllowDataLoss(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> forceFailoverAllowDataLossWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.forceFailoverAllowDataLoss(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), accept, + context); + } + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono forceFailoverAllowDataLossAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + return forceFailoverAllowDataLossWithResponseAsync(resourceGroupName, sqlServerInstanceName, + availabilityGroupName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response forceFailoverAllowDataLossWithResponse( + String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, Context context) { + return forceFailoverAllowDataLossWithResponseAsync(resourceGroupName, sqlServerInstanceName, + availabilityGroupName, context).block(); + } + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner forceFailoverAllowDataLoss(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + return forceFailoverAllowDataLossWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + Context.NONE).getValue(); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createAvailabilityGroupWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (createAgConfiguration == null) { + return Mono + .error(new IllegalArgumentException("Parameter createAgConfiguration is required and cannot be null.")); + } else { + createAgConfiguration.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createAvailabilityGroup(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), + createAgConfiguration, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createAvailabilityGroupWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, + 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (createAgConfiguration == null) { + return Mono + .error(new IllegalArgumentException("Parameter createAgConfiguration is required and cannot be null.")); + } else { + createAgConfiguration.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createAvailabilityGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), createAgConfiguration, accept, + context); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerAvailabilityGroupResourceInner> + beginCreateAvailabilityGroupAsync(String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupCreateUpdateConfiguration createAgConfiguration) { + Mono>> mono + = createAvailabilityGroupWithResponseAsync(resourceGroupName, sqlServerInstanceName, createAgConfiguration); + return this.client + .getLroResult(mono, + this.client.getHttpPipeline(), SqlServerAvailabilityGroupResourceInner.class, + SqlServerAvailabilityGroupResourceInner.class, this.client.getContext()); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group 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 the {@link PollerFlux} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerAvailabilityGroupResourceInner> + beginCreateAvailabilityGroupAsync(String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createAvailabilityGroupWithResponseAsync(resourceGroupName, + sqlServerInstanceName, createAgConfiguration, context); + return this.client + .getLroResult(mono, + this.client.getHttpPipeline(), SqlServerAvailabilityGroupResourceInner.class, + SqlServerAvailabilityGroupResourceInner.class, context); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupCreateUpdateConfiguration createAgConfiguration) { + return this.beginCreateAvailabilityGroupAsync(resourceGroupName, sqlServerInstanceName, createAgConfiguration) + .getSyncPoller(); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group 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 the {@link SyncPoller} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, Context context) { + return this + .beginCreateAvailabilityGroupAsync(resourceGroupName, sqlServerInstanceName, createAgConfiguration, context) + .getSyncPoller(); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAvailabilityGroupAsync(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration) { + return beginCreateAvailabilityGroupAsync(resourceGroupName, sqlServerInstanceName, createAgConfiguration).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAvailabilityGroupAsync(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, + Context context) { + return beginCreateAvailabilityGroupAsync(resourceGroupName, sqlServerInstanceName, createAgConfiguration, + context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner createAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration) { + return createAvailabilityGroupAsync(resourceGroupName, sqlServerInstanceName, createAgConfiguration).block(); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner createAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, + Context context) { + return createAvailabilityGroupAsync(resourceGroupName, sqlServerInstanceName, createAgConfiguration, context) + .block(); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createDistributedAvailabilityGroupWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (createDagConfiguration == null) { + return Mono.error( + new IllegalArgumentException("Parameter createDagConfiguration is required and cannot be null.")); + } else { + createDagConfiguration.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createDistributedAvailabilityGroup(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), + createDagConfiguration, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createDistributedAvailabilityGroupWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (createDagConfiguration == null) { + return Mono.error( + new IllegalArgumentException("Parameter createDagConfiguration is required and cannot be null.")); + } else { + createDagConfiguration.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createDistributedAvailabilityGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), createDagConfiguration, accept, + context); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerAvailabilityGroupResourceInner> + beginCreateDistributedAvailabilityGroupAsync(String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration) { + Mono>> mono = createDistributedAvailabilityGroupWithResponseAsync(resourceGroupName, + sqlServerInstanceName, createDagConfiguration); + return this.client + .getLroResult(mono, + this.client.getHttpPipeline(), SqlServerAvailabilityGroupResourceInner.class, + SqlServerAvailabilityGroupResourceInner.class, this.client.getContext()); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group 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 the {@link PollerFlux} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerAvailabilityGroupResourceInner> + beginCreateDistributedAvailabilityGroupAsync(String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createDistributedAvailabilityGroupWithResponseAsync(resourceGroupName, + sqlServerInstanceName, createDagConfiguration, context); + return this.client + .getLroResult(mono, + this.client.getHttpPipeline(), SqlServerAvailabilityGroupResourceInner.class, + SqlServerAvailabilityGroupResourceInner.class, context); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateDistributedAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration) { + return this + .beginCreateDistributedAvailabilityGroupAsync(resourceGroupName, sqlServerInstanceName, + createDagConfiguration) + .getSyncPoller(); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group 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 the {@link SyncPoller} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateDistributedAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, Context context) { + return this + .beginCreateDistributedAvailabilityGroupAsync(resourceGroupName, sqlServerInstanceName, + createDagConfiguration, context) + .getSyncPoller(); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createDistributedAvailabilityGroupAsync( + String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration) { + return beginCreateDistributedAvailabilityGroupAsync(resourceGroupName, sqlServerInstanceName, + createDagConfiguration).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createDistributedAvailabilityGroupAsync( + String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, Context context) { + return beginCreateDistributedAvailabilityGroupAsync(resourceGroupName, sqlServerInstanceName, + createDagConfiguration, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner createDistributedAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration) { + return createDistributedAvailabilityGroupAsync(resourceGroupName, sqlServerInstanceName, createDagConfiguration) + .block(); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner createDistributedAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, + Context context) { + return createDistributedAvailabilityGroupAsync(resourceGroupName, sqlServerInstanceName, createDagConfiguration, + context).block(); + } + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group 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 arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> addDatabasesWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, Databases databases) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + if (databases == null) { + return Mono.error(new IllegalArgumentException("Parameter databases is required and cannot be null.")); + } else { + databases.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.addDatabases(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), databases, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group 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 arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> addDatabasesWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, Databases databases, + 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + if (databases == null) { + return Mono.error(new IllegalArgumentException("Parameter databases is required and cannot be null.")); + } else { + databases.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.addDatabases(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), databases, accept, context); + } + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group 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 arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono addDatabasesAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases) { + return addDatabasesWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group 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 arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addDatabasesWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases, Context context) { + return addDatabasesWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases, + context).block(); + } + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group 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 arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner addDatabases(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Databases databases) { + return addDatabasesWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases, + Context.NONE).getValue(); + } + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group 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 arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> removeDatabasesWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, Databases databases) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + if (databases == null) { + return Mono.error(new IllegalArgumentException("Parameter databases is required and cannot be null.")); + } else { + databases.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.removeDatabases(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), databases, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group 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 arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> removeDatabasesWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, Databases databases, + 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (availabilityGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilityGroupName is required and cannot be null.")); + } + if (databases == null) { + return Mono.error(new IllegalArgumentException("Parameter databases is required and cannot be null.")); + } else { + databases.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.removeDatabases(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, availabilityGroupName, this.client.getApiVersion(), databases, accept, context); + } + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group 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 arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono removeDatabasesAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases) { + return removeDatabasesWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + databases).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group 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 arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response removeDatabasesWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases, Context context) { + return removeDatabasesWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + databases, context).block(); + } + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group 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 arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner removeDatabases(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases) { + return removeDatabasesWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases, + Context.NONE).getValue(); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String sqlServerInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), 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 the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String sqlServerInstanceName, 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, + this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, + String sqlServerInstanceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, sqlServerInstanceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, + String sqlServerInstanceName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, sqlServerInstanceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, + String sqlServerInstanceName) { + return new PagedIterable<>(listAsync(resourceGroupName, sqlServerInstanceName)); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, + String sqlServerInstanceName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, sqlServerInstanceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsImpl.java new file mode 100644 index 000000000000..22b49ac0303d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsImpl.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.azurearcdata.fluent.SqlServerAvailabilityGroupsClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.Databases; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroups; + +public final class SqlServerAvailabilityGroupsImpl implements SqlServerAvailabilityGroups { + private static final ClientLogger LOGGER = new ClientLogger(SqlServerAvailabilityGroupsImpl.class); + + private final SqlServerAvailabilityGroupsClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public SqlServerAvailabilityGroupsImpl(SqlServerAvailabilityGroupsClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName) { + this.serviceClient().delete(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + } + + public void delete(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + Context context) { + this.serviceClient().delete(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + } + + public Response getWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerAvailabilityGroupResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource get(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + SqlServerAvailabilityGroupResourceInner inner + = this.serviceClient().get(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response detailViewWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context) { + Response inner = this.serviceClient() + .detailViewWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerAvailabilityGroupResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource detailView(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + SqlServerAvailabilityGroupResourceInner inner + = this.serviceClient().detailView(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response failoverWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context) { + Response inner = this.serviceClient() + .failoverWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerAvailabilityGroupResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource failover(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + SqlServerAvailabilityGroupResourceInner inner + = this.serviceClient().failover(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response forceFailoverAllowDataLossWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context) { + Response inner = this.serviceClient() + .forceFailoverAllowDataLossWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerAvailabilityGroupResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource forceFailoverAllowDataLoss(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .forceFailoverAllowDataLoss(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource createAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .createAvailabilityGroup(resourceGroupName, sqlServerInstanceName, createAgConfiguration); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource createAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, + Context context) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .createAvailabilityGroup(resourceGroupName, sqlServerInstanceName, createAgConfiguration, context); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource createDistributedAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .createDistributedAvailabilityGroup(resourceGroupName, sqlServerInstanceName, createDagConfiguration); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource createDistributedAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, + Context context) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .createDistributedAvailabilityGroup(resourceGroupName, sqlServerInstanceName, createDagConfiguration, + context); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response addDatabasesWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases, Context context) { + Response inner = this.serviceClient() + .addDatabasesWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases, + context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerAvailabilityGroupResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource addDatabases(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Databases databases) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .addDatabases(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response removeDatabasesWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases, Context context) { + Response inner = this.serviceClient() + .removeDatabasesWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases, + context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerAvailabilityGroupResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource removeDatabases(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Databases databases) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .removeDatabases(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, + String sqlServerInstanceName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, sqlServerInstanceName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new SqlServerAvailabilityGroupResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, + String sqlServerInstanceName, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, sqlServerInstanceName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new SqlServerAvailabilityGroupResourceImpl(inner1, this.manager())); + } + + public SqlServerAvailabilityGroupResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); + if (sqlServerInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + } + String availabilityGroupName = ResourceManagerUtils.getValueFromIdByName(id, "availabilityGroups"); + if (availabilityGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'availabilityGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); + if (sqlServerInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + } + String availabilityGroupName = ResourceManagerUtils.getValueFromIdByName(id, "availabilityGroups"); + if (availabilityGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'availabilityGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.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 sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); + if (sqlServerInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + } + String availabilityGroupName = ResourceManagerUtils.getValueFromIdByName(id, "availabilityGroups"); + if (availabilityGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'availabilityGroups'.", id))); + } + this.delete(resourceGroupName, sqlServerInstanceName, availabilityGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); + if (sqlServerInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + } + String availabilityGroupName = ResourceManagerUtils.getValueFromIdByName(id, "availabilityGroups"); + if (availabilityGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'availabilityGroups'.", id))); + } + this.delete(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + } + + private SqlServerAvailabilityGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public SqlServerAvailabilityGroupResourceImpl define(String name) { + return new SqlServerAvailabilityGroupResourceImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabaseResourceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabaseResourceImpl.java new file mode 100644 index 000000000000..5fff8d09ffb1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabaseResourceImpl.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.azurearcdata.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerDatabaseResourceInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResource; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseUpdate; +import java.util.Collections; +import java.util.Map; + +public final class SqlServerDatabaseResourceImpl + implements SqlServerDatabaseResource, SqlServerDatabaseResource.Definition, SqlServerDatabaseResource.Update { + private SqlServerDatabaseResourceInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager 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 SqlServerDatabaseResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SqlServerDatabaseResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sqlServerInstanceName; + + private String databaseName; + + private SqlServerDatabaseUpdate updateSqlServerDatabaseUpdate; + + public SqlServerDatabaseResourceImpl withExistingSqlServerInstance(String resourceGroupName, + String sqlServerInstanceName) { + this.resourceGroupName = resourceGroupName; + this.sqlServerInstanceName = sqlServerInstanceName; + return this; + } + + public SqlServerDatabaseResource create() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerDatabases() + .createWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SqlServerDatabaseResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerDatabases() + .createWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, this.innerModel(), context) + .getValue(); + return this; + } + + SqlServerDatabaseResourceImpl(String name, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new SqlServerDatabaseResourceInner(); + this.serviceManager = serviceManager; + this.databaseName = name; + } + + public SqlServerDatabaseResourceImpl update() { + this.updateSqlServerDatabaseUpdate = new SqlServerDatabaseUpdate(); + return this; + } + + public SqlServerDatabaseResource apply() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerDatabases() + .update(resourceGroupName, sqlServerInstanceName, databaseName, updateSqlServerDatabaseUpdate, + Context.NONE); + return this; + } + + public SqlServerDatabaseResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerDatabases() + .update(resourceGroupName, sqlServerInstanceName, databaseName, updateSqlServerDatabaseUpdate, context); + return this; + } + + SqlServerDatabaseResourceImpl(SqlServerDatabaseResourceInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlServerInstances"); + this.databaseName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databases"); + } + + public SqlServerDatabaseResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerDatabases() + .getWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public SqlServerDatabaseResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerDatabases() + .getWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, context) + .getValue(); + return this; + } + + public SqlServerDatabaseResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SqlServerDatabaseResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SqlServerDatabaseResourceImpl withProperties(SqlServerDatabaseResourceProperties properties) { + if (isInCreateMode()) { + this.innerModel().withProperties(properties); + return this; + } else { + this.updateSqlServerDatabaseUpdate.withProperties(properties); + return this; + } + } + + public SqlServerDatabaseResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateSqlServerDatabaseUpdate.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesClientImpl.java new file mode 100644 index 000000000000..2ddb1d803a54 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesClientImpl.java @@ -0,0 +1,1115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerDatabasesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerDatabaseResourceInner; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerDatabaseListResult; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseUpdate; +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 SqlServerDatabasesClient. + */ +public final class SqlServerDatabasesClientImpl implements SqlServerDatabasesClient { + /** + * The proxy service used to perform REST calls. + */ + private final SqlServerDatabasesService service; + + /** + * The service client containing this operation class. + */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of SqlServerDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlServerDatabasesClientImpl(AzureArcDataManagementClientImpl client) { + this.service = RestProxy.create(SqlServerDatabasesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientSqlServerDatabases to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureArcDataManageme") + public interface SqlServerDatabasesService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("databaseName") String databaseName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlServerDatabaseResourceInner sqlServerDatabaseResource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("databaseName") String databaseName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("databaseName") String databaseName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("databaseName") String databaseName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlServerDatabaseUpdate sqlServerDatabaseUpdate, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Creates or replaces an Arc Sql Server Database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseResource The request body for database 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 arc Sql Server database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String databaseName, SqlServerDatabaseResourceInner sqlServerDatabaseResource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (sqlServerDatabaseResource == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlServerDatabaseResource is required and cannot be null.")); + } else { + sqlServerDatabaseResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, databaseName, this.client.getApiVersion(), + sqlServerDatabaseResource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces an Arc Sql Server Database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseResource The request body for database 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 arc Sql Server database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String databaseName, SqlServerDatabaseResourceInner sqlServerDatabaseResource, + 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (sqlServerDatabaseResource == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlServerDatabaseResource is required and cannot be null.")); + } else { + sqlServerDatabaseResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, databaseName, this.client.getApiVersion(), sqlServerDatabaseResource, accept, + context); + } + + /** + * Creates or replaces an Arc Sql Server Database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseResource The request body for database 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 arc Sql Server database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String sqlServerInstanceName, + String databaseName, SqlServerDatabaseResourceInner sqlServerDatabaseResource) { + return createWithResponseAsync(resourceGroupName, sqlServerInstanceName, databaseName, + sqlServerDatabaseResource).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or replaces an Arc Sql Server Database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseResource The request body for database 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 arc Sql Server database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, + String sqlServerInstanceName, String databaseName, SqlServerDatabaseResourceInner sqlServerDatabaseResource, + Context context) { + return createWithResponseAsync(resourceGroupName, sqlServerInstanceName, databaseName, + sqlServerDatabaseResource, context).block(); + } + + /** + * Creates or replaces an Arc Sql Server Database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseResource The request body for database 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 arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerDatabaseResourceInner create(String resourceGroupName, String sqlServerInstanceName, + String databaseName, SqlServerDatabaseResourceInner sqlServerDatabaseResource) { + return createWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseResource, + Context.NONE).getValue(); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, databaseName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, databaseName, this.client.getApiVersion(), accept, context); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String sqlServerInstanceName, + String databaseName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName, databaseName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String sqlServerInstanceName, + String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName, databaseName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + String databaseName) { + return this.beginDeleteAsync(resourceGroupName, sqlServerInstanceName, databaseName).getSyncPoller(); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + String databaseName, Context context) { + return this.beginDeleteAsync(resourceGroupName, sqlServerInstanceName, databaseName, context).getSyncPoller(); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String sqlServerInstanceName, String databaseName) { + return beginDeleteAsync(resourceGroupName, sqlServerInstanceName, databaseName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String sqlServerInstanceName, String databaseName, + Context context) { + return beginDeleteAsync(resourceGroupName, sqlServerInstanceName, databaseName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName) { + deleteAsync(resourceGroupName, sqlServerInstanceName, databaseName).block(); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName, Context context) { + deleteAsync(resourceGroupName, sqlServerInstanceName, databaseName, context).block(); + } + + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, databaseName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, databaseName, this.client.getApiVersion(), accept, context); + } + + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String sqlServerInstanceName, + String databaseName) { + return getWithResponseAsync(resourceGroupName, sqlServerInstanceName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String sqlServerInstanceName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, sqlServerInstanceName, databaseName, context).block(); + } + + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerDatabaseResourceInner get(String resourceGroupName, String sqlServerInstanceName, + String databaseName) { + return getWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, Context.NONE).getValue(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String databaseName, SqlServerDatabaseUpdate sqlServerDatabaseUpdate) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (sqlServerDatabaseUpdate == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlServerDatabaseUpdate is required and cannot be null.")); + } else { + sqlServerDatabaseUpdate.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, databaseName, this.client.getApiVersion(), + sqlServerDatabaseUpdate, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String databaseName, SqlServerDatabaseUpdate sqlServerDatabaseUpdate, + 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (sqlServerDatabaseUpdate == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlServerDatabaseUpdate is required and cannot be null.")); + } else { + sqlServerDatabaseUpdate.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, databaseName, this.client.getApiVersion(), sqlServerDatabaseUpdate, accept, context); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerDatabaseResourceInner> beginUpdateAsync( + String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseUpdate sqlServerDatabaseUpdate) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SqlServerDatabaseResourceInner.class, SqlServerDatabaseResourceInner.class, + this.client.getContext()); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerDatabaseResourceInner> beginUpdateAsync( + String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseUpdate sqlServerDatabaseUpdate, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(resourceGroupName, sqlServerInstanceName, + databaseName, sqlServerDatabaseUpdate, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SqlServerDatabaseResourceInner.class, SqlServerDatabaseResourceInner.class, + context); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerDatabaseResourceInner> beginUpdate( + String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseUpdate sqlServerDatabaseUpdate) { + return this.beginUpdateAsync(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate) + .getSyncPoller(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerDatabaseResourceInner> beginUpdate( + String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseUpdate sqlServerDatabaseUpdate, Context context) { + return this + .beginUpdateAsync(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate, context) + .getSyncPoller(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String sqlServerInstanceName, + String databaseName, SqlServerDatabaseUpdate sqlServerDatabaseUpdate) { + return beginUpdateAsync(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String sqlServerInstanceName, + String databaseName, SqlServerDatabaseUpdate sqlServerDatabaseUpdate, Context context) { + return beginUpdateAsync(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate, + context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerDatabaseResourceInner update(String resourceGroupName, String sqlServerInstanceName, + String databaseName, SqlServerDatabaseUpdate sqlServerDatabaseUpdate) { + return updateAsync(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate).block(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerDatabaseResourceInner update(String resourceGroupName, String sqlServerInstanceName, + String databaseName, SqlServerDatabaseUpdate sqlServerDatabaseUpdate, Context context) { + return updateAsync(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate, context) + .block(); + } + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String sqlServerInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), 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 the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String sqlServerInstanceName, 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, + this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, + String sqlServerInstanceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, sqlServerInstanceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String sqlServerInstanceName, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, sqlServerInstanceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String sqlServerInstanceName) { + return new PagedIterable<>(listAsync(resourceGroupName, sqlServerInstanceName)); + } + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String sqlServerInstanceName, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, sqlServerInstanceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesImpl.java new file mode 100644 index 000000000000..3c3d1cd7af0b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesImpl.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.azurearcdata.fluent.SqlServerDatabasesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerDatabaseResourceInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResource; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabases; + +public final class SqlServerDatabasesImpl implements SqlServerDatabases { + private static final ClientLogger LOGGER = new ClientLogger(SqlServerDatabasesImpl.class); + + private final SqlServerDatabasesClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public SqlServerDatabasesImpl(SqlServerDatabasesClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName) { + this.serviceClient().delete(resourceGroupName, sqlServerInstanceName, databaseName); + } + + public void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName, Context context) { + this.serviceClient().delete(resourceGroupName, sqlServerInstanceName, databaseName, context); + } + + public Response getWithResponse(String resourceGroupName, String sqlServerInstanceName, + String databaseName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerDatabaseResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlServerDatabaseResource get(String resourceGroupName, String sqlServerInstanceName, String databaseName) { + SqlServerDatabaseResourceInner inner + = this.serviceClient().get(resourceGroupName, sqlServerInstanceName, databaseName); + if (inner != null) { + return new SqlServerDatabaseResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String sqlServerInstanceName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, sqlServerInstanceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerDatabaseResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String sqlServerInstanceName, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, sqlServerInstanceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerDatabaseResourceImpl(inner1, this.manager())); + } + + public SqlServerDatabaseResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); + if (sqlServerInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + } + String databaseName = ResourceManagerUtils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); + if (sqlServerInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + } + String databaseName = ResourceManagerUtils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.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 sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); + if (sqlServerInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + } + String databaseName = ResourceManagerUtils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, sqlServerInstanceName, databaseName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); + if (sqlServerInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + } + String databaseName = ResourceManagerUtils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, sqlServerInstanceName, databaseName, context); + } + + private SqlServerDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public SqlServerDatabaseResourceImpl define(String name) { + return new SqlServerDatabaseResourceImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicenseImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicenseImpl.java new file mode 100644 index 000000000000..e1fb4ae0a4a1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicenseImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerEsuLicenseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicense; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdate; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdateProperties; +import java.util.Collections; +import java.util.Map; + +public final class SqlServerEsuLicenseImpl + implements SqlServerEsuLicense, SqlServerEsuLicense.Definition, SqlServerEsuLicense.Update { + private SqlServerEsuLicenseInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager 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 SqlServerEsuLicenseProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SqlServerEsuLicenseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sqlServerEsuLicenseName; + + private SqlServerEsuLicenseUpdate updateParameters; + + public SqlServerEsuLicenseImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public SqlServerEsuLicense create() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerEsuLicenses() + .createWithResponse(resourceGroupName, sqlServerEsuLicenseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SqlServerEsuLicense create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerEsuLicenses() + .createWithResponse(resourceGroupName, sqlServerEsuLicenseName, this.innerModel(), context) + .getValue(); + return this; + } + + SqlServerEsuLicenseImpl(String name, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new SqlServerEsuLicenseInner(); + this.serviceManager = serviceManager; + this.sqlServerEsuLicenseName = name; + } + + public SqlServerEsuLicenseImpl update() { + this.updateParameters = new SqlServerEsuLicenseUpdate(); + return this; + } + + public SqlServerEsuLicense apply() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerEsuLicenses() + .updateWithResponse(resourceGroupName, sqlServerEsuLicenseName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public SqlServerEsuLicense apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerEsuLicenses() + .updateWithResponse(resourceGroupName, sqlServerEsuLicenseName, updateParameters, context) + .getValue(); + return this; + } + + SqlServerEsuLicenseImpl(SqlServerEsuLicenseInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.sqlServerEsuLicenseName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlServerEsuLicenses"); + } + + public SqlServerEsuLicense refresh() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerEsuLicenses() + .getByResourceGroupWithResponse(resourceGroupName, sqlServerEsuLicenseName, Context.NONE) + .getValue(); + return this; + } + + public SqlServerEsuLicense refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerEsuLicenses() + .getByResourceGroupWithResponse(resourceGroupName, sqlServerEsuLicenseName, context) + .getValue(); + return this; + } + + public SqlServerEsuLicenseImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SqlServerEsuLicenseImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SqlServerEsuLicenseImpl withProperties(SqlServerEsuLicenseProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public SqlServerEsuLicenseImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public SqlServerEsuLicenseImpl withProperties(SqlServerEsuLicenseUpdateProperties properties) { + this.updateParameters.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicensesClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicensesClientImpl.java new file mode 100644 index 000000000000..ad2420b7ddfe --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicensesClientImpl.java @@ -0,0 +1,1029 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerEsuLicensesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerEsuLicenseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseListResult; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdate; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SqlServerEsuLicensesClient. + */ +public final class SqlServerEsuLicensesClientImpl implements SqlServerEsuLicensesClient { + /** + * The proxy service used to perform REST calls. + */ + private final SqlServerEsuLicensesService service; + + /** + * The service client containing this operation class. + */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of SqlServerEsuLicensesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlServerEsuLicensesClientImpl(AzureArcDataManagementClientImpl client) { + this.service = RestProxy.create(SqlServerEsuLicensesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientSqlServerEsuLicenses to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureArcDataManageme") + public interface SqlServerEsuLicensesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses/{sqlServerEsuLicenseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerEsuLicenseName") String sqlServerEsuLicenseName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses/{sqlServerEsuLicenseName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerEsuLicenseName") String sqlServerEsuLicenseName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlServerEsuLicenseInner sqlServerEsuLicense, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses/{sqlServerEsuLicenseName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerEsuLicenseName") String sqlServerEsuLicenseName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses/{sqlServerEsuLicenseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerEsuLicenseName") String sqlServerEsuLicenseName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlServerEsuLicenseUpdate parameters, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * List sqlServerEsuLicense resources in the 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 SQL Server ESU licenses 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.getSubscriptionId(), + this.client.getApiVersion(), 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 sqlServerEsuLicense resources in the 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 SQL Server ESU licenses 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.getSubscriptionId(), this.client.getApiVersion(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List sqlServerEsuLicense resources in the 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 SQL Server ESU licenses as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List sqlServerEsuLicense resources in the 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 SQL Server ESU licenses as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List sqlServerEsuLicense resources in the 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 SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List sqlServerEsuLicense resources in the 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 SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses 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 all sqlServerEsuLicenses in a resource group 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.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), 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 sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses 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 all sqlServerEsuLicenses in a resource group 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.getSubscriptionId(), resourceGroupName, + this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses 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 all sqlServerEsuLicenses in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses 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 all sqlServerEsuLicenses in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses 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 all sqlServerEsuLicenses in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses 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 all sqlServerEsuLicenses in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String sqlServerEsuLicenseName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerEsuLicenseName == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlServerEsuLicenseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerEsuLicenseName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String sqlServerEsuLicenseName, 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 (sqlServerEsuLicenseName == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlServerEsuLicenseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerEsuLicenseName, this.client.getApiVersion(), accept, context); + } + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String sqlServerEsuLicenseName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, sqlServerEsuLicenseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerEsuLicenseName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, sqlServerEsuLicenseName, context).block(); + } + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerEsuLicenseInner getByResourceGroup(String resourceGroupName, String sqlServerEsuLicenseName) { + return getByResourceGroupWithResponse(resourceGroupName, sqlServerEsuLicenseName, Context.NONE).getValue(); + } + + /** + * Creates or replaces a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param sqlServerEsuLicense The SQL Server ESU license to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String sqlServerEsuLicenseName, SqlServerEsuLicenseInner sqlServerEsuLicense) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerEsuLicenseName == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlServerEsuLicenseName is required and cannot be null.")); + } + if (sqlServerEsuLicense == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerEsuLicense is required and cannot be null.")); + } else { + sqlServerEsuLicense.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerEsuLicenseName, this.client.getApiVersion(), sqlServerEsuLicense, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param sqlServerEsuLicense The SQL Server ESU license to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String sqlServerEsuLicenseName, SqlServerEsuLicenseInner sqlServerEsuLicense, 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 (sqlServerEsuLicenseName == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlServerEsuLicenseName is required and cannot be null.")); + } + if (sqlServerEsuLicense == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerEsuLicense is required and cannot be null.")); + } else { + sqlServerEsuLicense.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerEsuLicenseName, this.client.getApiVersion(), sqlServerEsuLicense, accept, context); + } + + /** + * Creates or replaces a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param sqlServerEsuLicense The SQL Server ESU license to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String sqlServerEsuLicenseName, + SqlServerEsuLicenseInner sqlServerEsuLicense) { + return createWithResponseAsync(resourceGroupName, sqlServerEsuLicenseName, sqlServerEsuLicense) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or replaces a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param sqlServerEsuLicense The SQL Server ESU license to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, + String sqlServerEsuLicenseName, SqlServerEsuLicenseInner sqlServerEsuLicense, Context context) { + return createWithResponseAsync(resourceGroupName, sqlServerEsuLicenseName, sqlServerEsuLicense, context) + .block(); + } + + /** + * Creates or replaces a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param sqlServerEsuLicense The SQL Server ESU license to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerEsuLicenseInner create(String resourceGroupName, String sqlServerEsuLicenseName, + SqlServerEsuLicenseInner sqlServerEsuLicense) { + return createWithResponse(resourceGroupName, sqlServerEsuLicenseName, sqlServerEsuLicense, Context.NONE) + .getValue(); + } + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 sqlServerEsuLicenseName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerEsuLicenseName == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlServerEsuLicenseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerEsuLicenseName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 sqlServerEsuLicenseName, + 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 (sqlServerEsuLicenseName == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlServerEsuLicenseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerEsuLicenseName, this.client.getApiVersion(), accept, context); + } + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 sqlServerEsuLicenseName) { + return deleteWithResponseAsync(resourceGroupName, sqlServerEsuLicenseName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String sqlServerEsuLicenseName, + Context context) { + return deleteWithResponseAsync(resourceGroupName, sqlServerEsuLicenseName, context).block(); + } + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 sqlServerEsuLicenseName) { + deleteWithResponse(resourceGroupName, sqlServerEsuLicenseName, Context.NONE); + } + + /** + * Updates a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param parameters The SQL Server ESU license. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String sqlServerEsuLicenseName, SqlServerEsuLicenseUpdate 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 (sqlServerEsuLicenseName == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlServerEsuLicenseName 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.getSubscriptionId(), + resourceGroupName, sqlServerEsuLicenseName, this.client.getApiVersion(), parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param parameters The SQL Server ESU license. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String sqlServerEsuLicenseName, SqlServerEsuLicenseUpdate 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 (sqlServerEsuLicenseName == null) { + return Mono.error( + new IllegalArgumentException("Parameter sqlServerEsuLicenseName 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.getSubscriptionId(), resourceGroupName, + sqlServerEsuLicenseName, this.client.getApiVersion(), parameters, accept, context); + } + + /** + * Updates a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param parameters The SQL Server ESU license. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String sqlServerEsuLicenseName, + SqlServerEsuLicenseUpdate parameters) { + return updateWithResponseAsync(resourceGroupName, sqlServerEsuLicenseName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param parameters The SQL Server ESU license. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, + String sqlServerEsuLicenseName, SqlServerEsuLicenseUpdate parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, sqlServerEsuLicenseName, parameters, context).block(); + } + + /** + * Updates a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param parameters The SQL Server ESU license. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerEsuLicenseInner update(String resourceGroupName, String sqlServerEsuLicenseName, + SqlServerEsuLicenseUpdate parameters) { + return updateWithResponse(resourceGroupName, sqlServerEsuLicenseName, parameters, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses 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/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicensesImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicensesImpl.java new file mode 100644 index 000000000000..6c7215f00b82 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicensesImpl.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.azurearcdata.fluent.SqlServerEsuLicensesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerEsuLicenseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicense; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenses; + +public final class SqlServerEsuLicensesImpl implements SqlServerEsuLicenses { + private static final ClientLogger LOGGER = new ClientLogger(SqlServerEsuLicensesImpl.class); + + private final SqlServerEsuLicensesClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public SqlServerEsuLicensesImpl(SqlServerEsuLicensesClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerEsuLicenseImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerEsuLicenseImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerEsuLicenseImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerEsuLicenseImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerEsuLicenseName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, sqlServerEsuLicenseName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerEsuLicenseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlServerEsuLicense getByResourceGroup(String resourceGroupName, String sqlServerEsuLicenseName) { + SqlServerEsuLicenseInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, sqlServerEsuLicenseName); + if (inner != null) { + return new SqlServerEsuLicenseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String sqlServerEsuLicenseName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, sqlServerEsuLicenseName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String sqlServerEsuLicenseName) { + this.serviceClient().delete(resourceGroupName, sqlServerEsuLicenseName); + } + + public SqlServerEsuLicense getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 sqlServerEsuLicenseName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerEsuLicenses"); + if (sqlServerEsuLicenseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerEsuLicenses'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, sqlServerEsuLicenseName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 sqlServerEsuLicenseName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerEsuLicenses"); + if (sqlServerEsuLicenseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerEsuLicenses'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, sqlServerEsuLicenseName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.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 sqlServerEsuLicenseName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerEsuLicenses"); + if (sqlServerEsuLicenseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerEsuLicenses'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, sqlServerEsuLicenseName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 sqlServerEsuLicenseName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerEsuLicenses"); + if (sqlServerEsuLicenseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerEsuLicenses'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, sqlServerEsuLicenseName, context); + } + + private SqlServerEsuLicensesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public SqlServerEsuLicenseImpl define(String name) { + return new SqlServerEsuLicenseImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceImpl.java index 31698446e570..330b07bd7c6d 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceImpl.java @@ -4,14 +4,22 @@ package com.azure.resourcemanager.azurearcdata.implementation; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; import com.azure.core.management.Region; import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceInner; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstance; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusResponse; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunMigrationAssessmentResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryRequest; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceUpdate; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceUpdateProperties; import java.util.Collections; +import java.util.List; import java.util.Map; public final class SqlServerInstanceImpl @@ -85,20 +93,16 @@ public SqlServerInstanceImpl withExistingResourceGroup(String resourceGroupName) } public SqlServerInstance create() { - this.innerObject = - serviceManager - .serviceClient() - .getSqlServerInstances() - .create(resourceGroupName, sqlServerInstanceName, this.innerModel(), Context.NONE); + this.innerObject = serviceManager.serviceClient() + .getSqlServerInstances() + .create(resourceGroupName, sqlServerInstanceName, this.innerModel(), Context.NONE); return this; } public SqlServerInstance create(Context context) { - this.innerObject = - serviceManager - .serviceClient() - .getSqlServerInstances() - .create(resourceGroupName, sqlServerInstanceName, this.innerModel(), context); + this.innerObject = serviceManager.serviceClient() + .getSqlServerInstances() + .create(resourceGroupName, sqlServerInstanceName, this.innerModel(), context); return this; } @@ -114,53 +118,94 @@ public SqlServerInstanceImpl update() { } public SqlServerInstance apply() { - this.innerObject = - serviceManager - .serviceClient() - .getSqlServerInstances() - .updateWithResponse(resourceGroupName, sqlServerInstanceName, updateParameters, Context.NONE) - .getValue(); + this.innerObject = serviceManager.serviceClient() + .getSqlServerInstances() + .update(resourceGroupName, sqlServerInstanceName, updateParameters, Context.NONE); return this; } public SqlServerInstance apply(Context context) { - this.innerObject = - serviceManager - .serviceClient() - .getSqlServerInstances() - .updateWithResponse(resourceGroupName, sqlServerInstanceName, updateParameters, context) - .getValue(); + this.innerObject = serviceManager.serviceClient() + .getSqlServerInstances() + .update(resourceGroupName, sqlServerInstanceName, updateParameters, context); return this; } - SqlServerInstanceImpl( - SqlServerInstanceInner innerObject, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + SqlServerInstanceImpl(SqlServerInstanceInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; - this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.sqlServerInstanceName = Utils.getValueFromIdByName(innerObject.id(), "sqlServerInstances"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlServerInstances"); } public SqlServerInstance refresh() { - this.innerObject = - serviceManager - .serviceClient() - .getSqlServerInstances() - .getByResourceGroupWithResponse(resourceGroupName, sqlServerInstanceName, Context.NONE) - .getValue(); + this.innerObject = serviceManager.serviceClient() + .getSqlServerInstances() + .getByResourceGroupWithResponse(resourceGroupName, sqlServerInstanceName, Context.NONE) + .getValue(); return this; } public SqlServerInstance refresh(Context context) { - this.innerObject = - serviceManager - .serviceClient() - .getSqlServerInstances() - .getByResourceGroupWithResponse(resourceGroupName, sqlServerInstanceName, context) - .getValue(); + this.innerObject = serviceManager.serviceClient() + .getSqlServerInstances() + .getByResourceGroupWithResponse(resourceGroupName, sqlServerInstanceName, context) + .getValue(); return this; } + public PagedIterable> + getTelemetry(SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest) { + return serviceManager.sqlServerInstances() + .getTelemetry(resourceGroupName, sqlServerInstanceName, sqlServerInstanceTelemetryRequest); + } + + public PagedIterable> getTelemetry(SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, + Context context) { + return serviceManager.sqlServerInstances() + .getTelemetry(resourceGroupName, sqlServerInstanceName, sqlServerInstanceTelemetryRequest, context); + } + + public Response + runMigrationAssessmentWithResponse(Context context) { + return serviceManager.sqlServerInstances() + .runMigrationAssessmentWithResponse(resourceGroupName, sqlServerInstanceName, context); + } + + public SqlServerInstanceRunMigrationAssessmentResponse runMigrationAssessment() { + return serviceManager.sqlServerInstances().runMigrationAssessment(resourceGroupName, sqlServerInstanceName); + } + + public Response getJobsStatusWithResponse( + SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest, Context context) { + return serviceManager.sqlServerInstances() + .getJobsStatusWithResponse(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsStatusRequest, + context); + } + + public SqlServerInstanceJobsStatusResponse getJobsStatus() { + return serviceManager.sqlServerInstances().getJobsStatus(resourceGroupName, sqlServerInstanceName); + } + + public Response preUpgradeWithResponse(Context context) { + return serviceManager.sqlServerInstances() + .preUpgradeWithResponse(resourceGroupName, sqlServerInstanceName, context); + } + + public SqlServerInstance preUpgrade() { + return serviceManager.sqlServerInstances().preUpgrade(resourceGroupName, sqlServerInstanceName); + } + + public Response postUpgradeWithResponse(Context context) { + return serviceManager.sqlServerInstances() + .postUpgradeWithResponse(resourceGroupName, sqlServerInstanceName, context); + } + + public SqlServerInstance postUpgrade() { + return serviceManager.sqlServerInstances().postUpgrade(resourceGroupName, sqlServerInstanceName); + } + public SqlServerInstanceImpl withRegion(Region location) { this.innerModel().withLocation(location.toString()); return this; @@ -186,6 +231,11 @@ public SqlServerInstanceImpl withProperties(SqlServerInstanceProperties properti return this; } + public SqlServerInstanceImpl withProperties(SqlServerInstanceUpdateProperties properties) { + this.updateParameters.withProperties(properties); + return this; + } + private boolean isInCreateMode() { return this.innerModel().id() == null; } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceJobsStatusResponseImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceJobsStatusResponseImpl.java new file mode 100644 index 000000000000..dddfbb16362f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceJobsStatusResponseImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsStatusResponseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobStatus; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusResponse; +import java.util.Collections; +import java.util.List; + +public final class SqlServerInstanceJobsStatusResponseImpl implements SqlServerInstanceJobsStatusResponse { + private SqlServerInstanceJobsStatusResponseInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + SqlServerInstanceJobsStatusResponseImpl(SqlServerInstanceJobsStatusResponseInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List jobsStatus() { + List inner = this.innerModel().jobsStatus(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SqlServerInstanceJobsStatusResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunMigrationAssessmentResponseImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunMigrationAssessmentResponseImpl.java new file mode 100644 index 000000000000..489b5e7a7aaa --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunMigrationAssessmentResponseImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.models.BackgroundJob; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.SequencerAction; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunMigrationAssessmentResponse; +import java.util.Collections; +import java.util.List; + +public final class SqlServerInstanceRunMigrationAssessmentResponseImpl + implements SqlServerInstanceRunMigrationAssessmentResponse { + private SqlServerInstanceRunMigrationAssessmentResponseInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + SqlServerInstanceRunMigrationAssessmentResponseImpl( + SqlServerInstanceRunMigrationAssessmentResponseInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String instanceName() { + return this.innerModel().instanceName(); + } + + public JobStatus jobStatus() { + return this.innerModel().jobStatus(); + } + + public String jobException() { + return this.innerModel().jobException(); + } + + public BackgroundJob backgroundJob() { + return this.innerModel().backgroundJob(); + } + + public List sequencerActions() { + List inner = this.innerModel().sequencerActions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SqlServerInstanceRunMigrationAssessmentResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesClientImpl.java index 7776014f5219..753f87fbf47b 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesClientImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesClientImpl.java @@ -14,6 +14,7 @@ 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; @@ -34,28 +35,40 @@ import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient; import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsStatusResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusRequest; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceListResult; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryResponse; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceUpdate; import java.nio.ByteBuffer; +import java.util.List; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in SqlServerInstancesClient. */ +/** + * An instance of this class provides access to all the operations defined in SqlServerInstancesClient. + */ public final class SqlServerInstancesClientImpl implements SqlServerInstancesClient { - /** The proxy service used to perform REST calls. */ + /** + * The proxy service used to perform REST calls. + */ private final SqlServerInstancesService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final AzureArcDataManagementClientImpl client; /** * Initializes an instance of SqlServerInstancesClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ SqlServerInstancesClientImpl(AzureArcDataManagementClientImpl client) { - this.service = - RestProxy.create(SqlServerInstancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.service = RestProxy.create(SqlServerInstancesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); this.client = client; } @@ -66,117 +79,148 @@ public final class SqlServerInstancesClientImpl implements SqlServerInstancesCli @Host("{$host}") @ServiceInterface(name = "AzureArcDataManageme") public interface SqlServerInstancesService { - @Headers({"Content-Type: application/json"}) + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlServerInstances") - @ExpectedResponses({200}) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list( - @HostParam("$host") String endpoint, + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, - @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlServerInstances") - @ExpectedResponses({200}) + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup( - @HostParam("$host") String endpoint, + Mono> getByResourceGroup(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlServerInstances/{sqlServerInstanceName}") - @ExpectedResponses({200}) + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") + @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup( - @HostParam("$host") String endpoint, + Mono>> create(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); + @BodyParam("application/json") SqlServerInstanceInner sqlServerInstance, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlServerInstances/{sqlServerInstanceName}") - @ExpectedResponses({200, 201}) + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") + @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> create( - @HostParam("$host") String endpoint, + Mono>> update(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") SqlServerInstanceInner sqlServerInstance, - @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceUpdate parameters, @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlServerInstances/{sqlServerInstanceName}") - @ExpectedResponses({200, 202, 204}) + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/getTelemetry") + @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete( - @HostParam("$host") String endpoint, + Mono>> getTelemetry(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); + @BodyParam("application/json") SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/runMigrationAssessment") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> runMigrationAssessment( + @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlServerInstances/{sqlServerInstanceName}") - @ExpectedResponses({200}) + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/getJobsStatus") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update( - @HostParam("$host") String endpoint, + Mono> getJobsStatus(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") SqlServerInstanceUpdate parameters, - @HeaderParam("Accept") String accept, - Context context); + @BodyParam("application/json") SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/preUpgrade") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> preUpgrade(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/postUpgrade") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> postUpgrade(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") - @ExpectedResponses({200}) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") - @ExpectedResponses({200}) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Accept: application/json", "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> + postInstanceTelemetry(@PathParam(value = "nextLink", encoded = true) String nextLink, Context context); } /** * List sqlServerInstance resources in the 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 SqlServerInstance along with {@link PagedResponse} on successful completion of {@link Mono}. @@ -184,43 +228,25 @@ Mono> listByResourceGroupNext( @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.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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.getSubscriptionId(), - this.client.getApiVersion(), - accept, - context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getApiVersion(), 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 sqlServerInstance resources in the 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. @@ -230,40 +256,25 @@ private Mono> listSinglePageAsync() { @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.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be 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.getSubscriptionId(), - this.client.getApiVersion(), - accept, + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** * List sqlServerInstance resources in the 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 SqlServerInstance as paginated response with {@link PagedFlux}. @@ -275,7 +286,7 @@ private PagedFlux listAsync() { /** * List sqlServerInstance resources in the 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. @@ -284,13 +295,13 @@ private PagedFlux listAsync() { */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Context context) { - return new PagedFlux<>( - () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); } /** * List sqlServerInstance resources in the 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 SqlServerInstance as paginated response with {@link PagedIterable}. @@ -302,7 +313,7 @@ public PagedIterable list() { /** * List sqlServerInstance resources in the 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. @@ -316,29 +327,25 @@ public PagedIterable list(Context context) { /** * List sqlServerInstance resources in the resource group - * - *

Gets all sqlServerInstances in a resource group. - * + * + * Gets all sqlServerInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all sqlServerInstances in a resource group along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@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.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -346,55 +353,36 @@ private Mono> listByResourceGroupSinglePag } final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service - .listByResourceGroup( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - this.client.getApiVersion(), - accept, - context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), 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 sqlServerInstance resources in the resource group - * - *

Gets all sqlServerInstances in a resource group. - * + * + * Gets all sqlServerInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all sqlServerInstances in a resource group along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync( - String resourceGroupName, Context context) { + 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.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -403,29 +391,17 @@ private Mono> listByResourceGroupSinglePag final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listByResourceGroup( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - this.client.getApiVersion(), - accept, - context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + .listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** * List sqlServerInstance resources in the resource group - * - *

Gets all sqlServerInstances in a resource group. - * + * + * Gets all sqlServerInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -434,16 +410,15 @@ private Mono> listByResourceGroupSinglePag */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>( - () -> listByResourceGroupSinglePageAsync(resourceGroupName), + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** * List sqlServerInstance resources in the resource group - * - *

Gets all sqlServerInstances in a resource group. - * + * + * Gets all sqlServerInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -453,16 +428,15 @@ private PagedFlux listByResourceGroupAsync(String resour */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>( - () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); } /** * List sqlServerInstance resources in the resource group - * - *

Gets all sqlServerInstances in a resource group. - * + * + * Gets all sqlServerInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -476,9 +450,9 @@ public PagedIterable listByResourceGroup(String resource /** * List sqlServerInstance resources in the resource group - * - *

Gets all sqlServerInstances in a resource group. - * + * + * Gets all sqlServerInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -493,7 +467,7 @@ public PagedIterable listByResourceGroup(String resource /** * Retrieves a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -502,19 +476,15 @@ public PagedIterable listByResourceGroup(String resource * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync( - String resourceGroupName, String sqlServerInstanceName) { + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -527,22 +497,14 @@ private Mono> getByResourceGroupWithResponseAsy final String accept = "application/json"; return FluxUtil .withContext( - context -> - service - .getByResourceGroup( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - sqlServerInstanceName, - this.client.getApiVersion(), - accept, - context)) + context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Retrieves a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. @@ -552,19 +514,15 @@ private Mono> getByResourceGroupWithResponseAsy * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync( - String resourceGroupName, String sqlServerInstanceName, Context context) { + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -576,20 +534,13 @@ private Mono> getByResourceGroupWithResponseAsy } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .getByResourceGroup( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - sqlServerInstanceName, - this.client.getApiVersion(), - accept, - context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, this.client.getApiVersion(), accept, context); } /** * Retrieves a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -598,15 +549,15 @@ private Mono> getByResourceGroupWithResponseAsy * @return a SqlServerInstance on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync( - String resourceGroupName, String sqlServerInstanceName) { + private Mono getByResourceGroupAsync(String resourceGroupName, + String sqlServerInstanceName) { return getByResourceGroupWithResponseAsync(resourceGroupName, sqlServerInstanceName) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Retrieves a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. @@ -616,14 +567,14 @@ private Mono getByResourceGroupAsync( * @return a SqlServerInstance along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse( - String resourceGroupName, String sqlServerInstanceName, Context context) { + public Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerInstanceName, Context context) { return getByResourceGroupWithResponseAsync(resourceGroupName, sqlServerInstanceName, context).block(); } /** * Retrieves a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -638,9 +589,9 @@ public SqlServerInstanceInner getByResourceGroup(String resourceGroupName, Strin /** * Creates or replaces a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param sqlServerInstance The SQL Server Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -648,19 +599,15 @@ public SqlServerInstanceInner getByResourceGroup(String resourceGroupName, Strin * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createWithResponseAsync( - String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance) { + private Mono>> createWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -679,25 +626,16 @@ private Mono>> createWithResponseAsync( final String accept = "application/json"; return FluxUtil .withContext( - context -> - service - .create( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - sqlServerInstanceName, - this.client.getApiVersion(), - sqlServerInstance, - accept, - context)) + context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, this.client.getApiVersion(), sqlServerInstance, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Creates or replaces a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param sqlServerInstance The SQL Server Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -706,22 +644,15 @@ private Mono>> createWithResponseAsync( * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createWithResponseAsync( - String resourceGroupName, - String sqlServerInstanceName, - SqlServerInstanceInner sqlServerInstance, - Context context) { + private Mono>> createWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance, Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -739,23 +670,15 @@ private Mono>> createWithResponseAsync( } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .create( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - sqlServerInstanceName, - this.client.getApiVersion(), - sqlServerInstance, - accept, - context); + return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, this.client.getApiVersion(), sqlServerInstance, accept, context); } /** * Creates or replaces a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param sqlServerInstance The SQL Server Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -765,23 +688,18 @@ private Mono>> createWithResponseAsync( @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, SqlServerInstanceInner> beginCreateAsync( String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance) { - Mono>> mono = - createWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance); - return this - .client - .getLroResult( - mono, - this.client.getHttpPipeline(), - SqlServerInstanceInner.class, - SqlServerInstanceInner.class, - this.client.getContext()); + Mono>> mono + = createWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SqlServerInstanceInner.class, SqlServerInstanceInner.class, + this.client.getContext()); } /** * Creates or replaces a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param sqlServerInstance The SQL Server Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -791,28 +709,20 @@ private PollerFlux, SqlServerInstanceInner> b */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, SqlServerInstanceInner> beginCreateAsync( - String resourceGroupName, - String sqlServerInstanceName, - SqlServerInstanceInner sqlServerInstance, + String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance, Context context) { context = this.client.mergeContext(context); - Mono>> mono = - createWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, context); - return this - .client - .getLroResult( - mono, - this.client.getHttpPipeline(), - SqlServerInstanceInner.class, - SqlServerInstanceInner.class, - context); + Mono>> mono + = createWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SqlServerInstanceInner.class, SqlServerInstanceInner.class, context); } /** * Creates or replaces a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param sqlServerInstance The SQL Server Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -820,16 +730,16 @@ private PollerFlux, SqlServerInstanceInner> b * @return the {@link SyncPoller} for polling of a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, SqlServerInstanceInner> beginCreate( - String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance) { + public SyncPoller, SqlServerInstanceInner> beginCreate(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance) { return this.beginCreateAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance).getSyncPoller(); } /** * Creates or replaces a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param sqlServerInstance The SQL Server Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -838,21 +748,17 @@ public SyncPoller, SqlServerInstanceInner> be * @return the {@link SyncPoller} for polling of a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, SqlServerInstanceInner> beginCreate( - String resourceGroupName, - String sqlServerInstanceName, - SqlServerInstanceInner sqlServerInstance, - Context context) { - return this - .beginCreateAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, context) + public SyncPoller, SqlServerInstanceInner> beginCreate(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance, Context context) { + return this.beginCreateAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, context) .getSyncPoller(); } /** * Creates or replaces a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param sqlServerInstance The SQL Server Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -860,18 +766,17 @@ public SyncPoller, SqlServerInstanceInner> be * @return a SqlServerInstance on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync( - String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance) { - return beginCreateAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance) - .last() + private Mono createAsync(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceInner sqlServerInstance) { + return beginCreateAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance).last() .flatMap(this.client::getLroFinalResultOrError); } /** * Creates or replaces a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param sqlServerInstance The SQL Server Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -880,21 +785,17 @@ private Mono createAsync( * @return a SqlServerInstance on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync( - String resourceGroupName, - String sqlServerInstanceName, - SqlServerInstanceInner sqlServerInstance, - Context context) { - return beginCreateAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, context) - .last() + private Mono createAsync(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceInner sqlServerInstance, Context context) { + return beginCreateAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, context).last() .flatMap(this.client::getLroFinalResultOrError); } /** * Creates or replaces a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param sqlServerInstance The SQL Server Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -902,16 +803,16 @@ private Mono createAsync( * @return a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SqlServerInstanceInner create( - String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance) { + public SqlServerInstanceInner create(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceInner sqlServerInstance) { return createAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance).block(); } /** * Creates or replaces a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param sqlServerInstance The SQL Server Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -920,38 +821,31 @@ public SqlServerInstanceInner create( * @return a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SqlServerInstanceInner create( - String resourceGroupName, - String sqlServerInstanceName, - SqlServerInstanceInner sqlServerInstance, - Context context) { + public SqlServerInstanceInner create(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceInner sqlServerInstance, Context context) { return createAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, context).block(); } /** * Deletes a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 sqlServerInstanceName) { + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -963,25 +857,16 @@ private Mono>> deleteWithResponseAsync( } final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service - .delete( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - sqlServerInstanceName, - this.client.getApiVersion(), - accept, - context)) + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Deletes a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -989,19 +874,15 @@ private Mono>> deleteWithResponseAsync( * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync( - String resourceGroupName, String sqlServerInstanceName, Context context) { + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -1013,42 +894,33 @@ private Mono>> deleteWithResponseAsync( } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .delete( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - sqlServerInstanceName, - this.client.getApiVersion(), - accept, - context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, this.client.getApiVersion(), accept, context); } /** * Deletes a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 sqlServerInstanceName) { + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String sqlServerInstanceName) { Mono>> mono = deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName); - return this - .client - .getLroResult( - mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); } /** * Deletes a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1056,21 +928,20 @@ private PollerFlux, Void> beginDeleteAsync( * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync( - String resourceGroupName, String sqlServerInstanceName, Context context) { + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String sqlServerInstanceName, + Context context) { context = this.client.mergeContext(context); - Mono>> mono = - deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName, context); - return this - .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); } /** * Deletes a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1083,9 +954,9 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, /** * Deletes a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1093,16 +964,16 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete( - String resourceGroupName, String sqlServerInstanceName, Context context) { + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + Context context) { return this.beginDeleteAsync(resourceGroupName, sqlServerInstanceName, context).getSyncPoller(); } /** * Deletes a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1110,16 +981,15 @@ public SyncPoller, Void> beginDelete( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String sqlServerInstanceName) { - return beginDeleteAsync(resourceGroupName, sqlServerInstanceName) - .last() + return beginDeleteAsync(resourceGroupName, sqlServerInstanceName).last() .flatMap(this.client::getLroFinalResultOrError); } /** * Deletes a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1128,16 +998,15 @@ private Mono deleteAsync(String resourceGroupName, String sqlServerInstanc */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String sqlServerInstanceName, Context context) { - return beginDeleteAsync(resourceGroupName, sqlServerInstanceName, context) - .last() + return beginDeleteAsync(resourceGroupName, sqlServerInstanceName, context).last() .flatMap(this.client::getLroFinalResultOrError); } /** * Deletes a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1149,9 +1018,9 @@ public void delete(String resourceGroupName, String sqlServerInstanceName) { /** * Deletes a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1164,9 +1033,9 @@ public void delete(String resourceGroupName, String sqlServerInstanceName, Conte /** * Updates a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName Name of sqlServerInstance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param parameters The SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1174,19 +1043,15 @@ public void delete(String resourceGroupName, String sqlServerInstanceName, Conte * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( - String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceUpdate parameters) { + private Mono>> updateWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceUpdate parameters) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -1203,26 +1068,16 @@ private Mono> updateWithResponseAsync( } final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service - .update( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - sqlServerInstanceName, - this.client.getApiVersion(), - parameters, - accept, - context)) + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), parameters, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Updates a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName Name of sqlServerInstance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param parameters The SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1231,19 +1086,15 @@ private Mono> updateWithResponseAsync( * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( - String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceUpdate parameters, Context context) { + private Mono>> updateWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceUpdate parameters, Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -1260,23 +1111,93 @@ private Mono> updateWithResponseAsync( } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .update( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - sqlServerInstanceName, - this.client.getApiVersion(), - parameters, - accept, - context); + return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, this.client.getApiVersion(), parameters, accept, context); + } + + /** + * Updates a SQL Server Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerInstanceInner> + beginUpdateAsync(String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceUpdate parameters) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, sqlServerInstanceName, parameters); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SqlServerInstanceInner.class, SqlServerInstanceInner.class, + this.client.getContext()); + } + + /** + * Updates a SQL Server Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerInstanceInner> beginUpdateAsync( + String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, sqlServerInstanceName, parameters, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SqlServerInstanceInner.class, SqlServerInstanceInner.class, context); + } + + /** + * Updates a SQL Server Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerInstanceInner> beginUpdate(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceUpdate parameters) { + return this.beginUpdateAsync(resourceGroupName, sqlServerInstanceName, parameters).getSyncPoller(); + } + + /** + * Updates a SQL Server Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerInstanceInner> beginUpdate(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceUpdate parameters, Context context) { + return this.beginUpdateAsync(resourceGroupName, sqlServerInstanceName, parameters, context).getSyncPoller(); } /** * Updates a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName Name of sqlServerInstance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param parameters The SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1284,35 +1205,36 @@ private Mono> updateWithResponseAsync( * @return a SqlServerInstance on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync( - String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceUpdate parameters) { - return updateWithResponseAsync(resourceGroupName, sqlServerInstanceName, parameters) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono updateAsync(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceUpdate parameters) { + return beginUpdateAsync(resourceGroupName, sqlServerInstanceName, parameters).last() + .flatMap(this.client::getLroFinalResultOrError); } /** * Updates a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName Name of sqlServerInstance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param parameters The SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance along with {@link Response}. + * @return a SqlServerInstance on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse( - String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceUpdate parameters, Context context) { - return updateWithResponseAsync(resourceGroupName, sqlServerInstanceName, parameters, context).block(); + private Mono updateAsync(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, sqlServerInstanceName, parameters, context).last() + .flatMap(this.client::getLroFinalResultOrError); } /** * Updates a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName Name of sqlServerInstance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param parameters The SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1320,156 +1242,878 @@ public Response updateWithResponse( * @return a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SqlServerInstanceInner update( - String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceUpdate parameters) { - return updateWithResponse(resourceGroupName, sqlServerInstanceName, parameters, Context.NONE).getValue(); + public SqlServerInstanceInner update(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceUpdate parameters) { + return updateAsync(resourceGroupName, sqlServerInstanceName, parameters).block(); } /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * Updates a SQL Server Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a SqlServerInstance. */ @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.")); - } + public SqlServerInstanceInner update(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceUpdate parameters, Context context) { + return updateAsync(resourceGroupName, sqlServerInstanceName, parameters, context).block(); + } + + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a section of the telemetry response for the SQL Server instance along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> getTelemetrySinglePageAsync(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest) { if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (sqlServerInstanceTelemetryRequest == null) { + return Mono.error(new IllegalArgumentException( + "Parameter sqlServerInstanceTelemetryRequest is required and cannot be null.")); + } else { + sqlServerInstanceTelemetryRequest.validate(); } 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)) + return FluxUtil.withContext(context -> { + Mono>> mono + = service + .getTelemetry(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, this.client.getApiVersion(), sqlServerInstanceTelemetryRequest, accept, + context) + .cache(); + return Mono.zip(mono, + this.client + .getLroResult(mono, + this.client.getHttpPipeline(), SqlServerInstanceTelemetryResponse.class, + SqlServerInstanceTelemetryResponse.class, this.client.getContext()) + .last() + .flatMap(this.client::getLroFinalResultOrError)); + }) + .>>map( + res -> new PagedResponseBase<>(res.getT1().getRequest(), res.getT1().getStatusCode(), + res.getT1().getHeaders(), res.getT2().rows(), res.getT2().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. + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a section of the telemetry response for the SQL Server instance 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.")); - } + private Mono>> getTelemetrySinglePageAsync(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, + 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 (sqlServerInstanceName == null) { return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (sqlServerInstanceTelemetryRequest == null) { + return Mono.error(new IllegalArgumentException( + "Parameter sqlServerInstanceTelemetryRequest is required and cannot be null.")); + } else { + sqlServerInstanceTelemetryRequest.validate(); } 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)); + Mono>> mono = service + .getTelemetry(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, this.client.getApiVersion(), sqlServerInstanceTelemetryRequest, accept, context) + .cache(); + return Mono + .zip(mono, + this.client + .getLroResult(mono, + this.client.getHttpPipeline(), SqlServerInstanceTelemetryResponse.class, + SqlServerInstanceTelemetryResponse.class, context) + .last() + .flatMap(this.client::getLroFinalResultOrError)) + .map(res -> new PagedResponseBase<>(res.getT1().getRequest(), res.getT1().getStatusCode(), + res.getT1().getHeaders(), res.getT2().rows(), res.getT2().nextLink(), null)); } /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a section of the telemetry response for the SQL Server instance as paginated response with + * {@link PagedFlux}. */ - @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())); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux> getTelemetryAsync(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest) { + return new PagedFlux<>(() -> getTelemetrySinglePageAsync(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceTelemetryRequest), nextLink -> postInstanceTelemetrySinglePageAsync(nextLink)); } /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a section of the telemetry response for the SQL Server instance as paginated response with + * {@link PagedFlux}. */ - @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.")); - } + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux> getTelemetryAsync(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, Context context) { + return new PagedFlux<>( + () -> getTelemetrySinglePageAsync(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceTelemetryRequest, context), + nextLink -> postInstanceTelemetrySinglePageAsync(nextLink, context)); + } + + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a section of the telemetry response for the SQL Server instance as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable> getTelemetry(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest) { + return new PagedIterable<>( + getTelemetryAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstanceTelemetryRequest)); + } + + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a section of the telemetry response for the SQL Server instance as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable> getTelemetry(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, Context context) { + return new PagedIterable<>( + getTelemetryAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstanceTelemetryRequest, context)); + } + + /** + * Runs migration assessment for SQL Server instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + runMigrationAssessmentWithResponseAsync(String resourceGroupName, String sqlServerInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.runMigrationAssessment(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Runs migration assessment for SQL Server instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + runMigrationAssessmentWithResponseAsync(String resourceGroupName, String sqlServerInstanceName, + 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 this.client.getEndpoint() is required and cannot be null.")); + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName 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)); + return service.runMigrationAssessment(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), accept, context); + } + + /** + * Runs migration assessment for SQL Server instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono + runMigrationAssessmentAsync(String resourceGroupName, String sqlServerInstanceName) { + return runMigrationAssessmentWithResponseAsync(resourceGroupName, sqlServerInstanceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Runs migration assessment for SQL Server instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response + runMigrationAssessmentWithResponse(String resourceGroupName, String sqlServerInstanceName, Context context) { + return runMigrationAssessmentWithResponseAsync(resourceGroupName, sqlServerInstanceName, context).block(); + } + + /** + * Runs migration assessment for SQL Server instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceRunMigrationAssessmentResponseInner runMigrationAssessment(String resourceGroupName, + String sqlServerInstanceName) { + return runMigrationAssessmentWithResponse(resourceGroupName, sqlServerInstanceName, Context.NONE).getValue(); + } + + /** + * Gets jobs status details for sql arc resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsStatusRequest Contains the parameters to get SQL Server instance agent jobs status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getJobsStatusWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (sqlServerInstanceJobsStatusRequest != null) { + sqlServerInstanceJobsStatusRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getJobsStatus(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), + sqlServerInstanceJobsStatusRequest, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets jobs status details for sql arc resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsStatusRequest Contains the parameters to get SQL Server instance agent jobs status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getJobsStatusWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest, 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (sqlServerInstanceJobsStatusRequest != null) { + sqlServerInstanceJobsStatusRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getJobsStatus(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, this.client.getApiVersion(), sqlServerInstanceJobsStatusRequest, accept, context); + } + + /** + * Gets jobs status details for sql arc resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getJobsStatusAsync(String resourceGroupName, + String sqlServerInstanceName) { + final SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest = null; + return getJobsStatusWithResponseAsync(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceJobsStatusRequest).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets jobs status details for sql arc resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsStatusRequest Contains the parameters to get SQL Server instance agent jobs status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getJobsStatusWithResponse(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest, + Context context) { + return getJobsStatusWithResponseAsync(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceJobsStatusRequest, context).block(); + } + + /** + * Gets jobs status details for sql arc resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceJobsStatusResponseInner getJobsStatus(String resourceGroupName, + String sqlServerInstanceName) { + final SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest = null; + return getJobsStatusWithResponse(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsStatusRequest, + Context.NONE).getValue(); + } + + /** + * Request Upgrade Permission before upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> preUpgradeWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.preUpgrade(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Request Upgrade Permission before upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> preUpgradeWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.preUpgrade(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, this.client.getApiVersion(), accept, context); + } + + /** + * Request Upgrade Permission before upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono preUpgradeAsync(String resourceGroupName, String sqlServerInstanceName) { + return preUpgradeWithResponseAsync(resourceGroupName, sqlServerInstanceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Request Upgrade Permission before upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response preUpgradeWithResponse(String resourceGroupName, + String sqlServerInstanceName, Context context) { + return preUpgradeWithResponseAsync(resourceGroupName, sqlServerInstanceName, context).block(); + } + + /** + * Request Upgrade Permission before upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceInner preUpgrade(String resourceGroupName, String sqlServerInstanceName) { + return preUpgradeWithResponse(resourceGroupName, sqlServerInstanceName, Context.NONE).getValue(); + } + + /** + * Clean up after upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> postUpgradeWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.postUpgrade(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Clean up after upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> postUpgradeWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, 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 (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.postUpgrade(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, this.client.getApiVersion(), accept, context); + } + + /** + * Clean up after upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono postUpgradeAsync(String resourceGroupName, String sqlServerInstanceName) { + return postUpgradeWithResponseAsync(resourceGroupName, sqlServerInstanceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Clean up after upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postUpgradeWithResponse(String resourceGroupName, + String sqlServerInstanceName, Context context) { + return postUpgradeWithResponseAsync(resourceGroupName, sqlServerInstanceName, context).block(); + } + + /** + * Clean up after upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceInner postUpgrade(String resourceGroupName, String sqlServerInstanceName) { + return postUpgradeWithResponse(resourceGroupName, sqlServerInstanceName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a section of the telemetry response for the SQL Server instance along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> postInstanceTelemetrySinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + return FluxUtil.withContext(context -> service.postInstanceTelemetry(nextLink, context)) + .>>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().rows(), 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a section of the telemetry response for the SQL Server instance along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> postInstanceTelemetrySinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service.postInstanceTelemetry(nextLink, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().rows(), res.getValue().nextLink(), null)); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesImpl.java index 03f743c3e5f4..1123b6562db0 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesImpl.java @@ -11,8 +11,15 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient; import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsStatusResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationAssessmentResponseInner; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstance; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunMigrationAssessmentResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryRequest; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstances; +import java.util.List; public final class SqlServerInstancesImpl implements SqlServerInstances { private static final ClientLogger LOGGER = new ClientLogger(SqlServerInstancesImpl.class); @@ -21,8 +28,7 @@ public final class SqlServerInstancesImpl implements SqlServerInstances { private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; - public SqlServerInstancesImpl( - SqlServerInstancesClient innerClient, + public SqlServerInstancesImpl(SqlServerInstancesClient innerClient, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; @@ -30,34 +36,31 @@ public SqlServerInstancesImpl( public PagedIterable list() { PagedIterable inner = this.serviceClient().list(); - return Utils.mapPage(inner, inner1 -> new SqlServerInstanceImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerInstanceImpl(inner1, this.manager())); } public PagedIterable list(Context context) { PagedIterable inner = this.serviceClient().list(context); - return Utils.mapPage(inner, inner1 -> new SqlServerInstanceImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerInstanceImpl(inner1, this.manager())); } public PagedIterable listByResourceGroup(String resourceGroupName) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return Utils.mapPage(inner, inner1 -> new SqlServerInstanceImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerInstanceImpl(inner1, this.manager())); } public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - PagedIterable inner = - this.serviceClient().listByResourceGroup(resourceGroupName, context); - return Utils.mapPage(inner, inner1 -> new SqlServerInstanceImpl(inner1, this.manager())); + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerInstanceImpl(inner1, this.manager())); } - public Response getByResourceGroupWithResponse( - String resourceGroupName, String sqlServerInstanceName, Context context) { - Response inner = - this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, sqlServerInstanceName, context); + public Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerInstanceName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, sqlServerInstanceName, context); if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), new SqlServerInstanceImpl(inner.getValue(), this.manager())); } else { return null; @@ -65,8 +68,8 @@ public Response getByResourceGroupWithResponse( } public SqlServerInstance getByResourceGroup(String resourceGroupName, String sqlServerInstanceName) { - SqlServerInstanceInner inner = - this.serviceClient().getByResourceGroup(resourceGroupName, sqlServerInstanceName); + SqlServerInstanceInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, sqlServerInstanceName); if (inner != null) { return new SqlServerInstanceImpl(inner, this.manager()); } else { @@ -82,86 +85,159 @@ public void delete(String resourceGroupName, String sqlServerInstanceName, Conte this.serviceClient().delete(resourceGroupName, sqlServerInstanceName, context); } + public PagedIterable> getTelemetry(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest) { + return this.serviceClient() + .getTelemetry(resourceGroupName, sqlServerInstanceName, sqlServerInstanceTelemetryRequest); + } + + public PagedIterable> getTelemetry(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, Context context) { + return this.serviceClient() + .getTelemetry(resourceGroupName, sqlServerInstanceName, sqlServerInstanceTelemetryRequest, context); + } + + public Response + runMigrationAssessmentWithResponse(String resourceGroupName, String sqlServerInstanceName, Context context) { + Response inner = this.serviceClient() + .runMigrationAssessmentWithResponse(resourceGroupName, sqlServerInstanceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerInstanceRunMigrationAssessmentResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlServerInstanceRunMigrationAssessmentResponse runMigrationAssessment(String resourceGroupName, + String sqlServerInstanceName) { + SqlServerInstanceRunMigrationAssessmentResponseInner inner + = this.serviceClient().runMigrationAssessment(resourceGroupName, sqlServerInstanceName); + if (inner != null) { + return new SqlServerInstanceRunMigrationAssessmentResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getJobsStatusWithResponse(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest, + Context context) { + Response inner = this.serviceClient() + .getJobsStatusWithResponse(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsStatusRequest, + context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerInstanceJobsStatusResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlServerInstanceJobsStatusResponse getJobsStatus(String resourceGroupName, String sqlServerInstanceName) { + SqlServerInstanceJobsStatusResponseInner inner + = this.serviceClient().getJobsStatus(resourceGroupName, sqlServerInstanceName); + if (inner != null) { + return new SqlServerInstanceJobsStatusResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response preUpgradeWithResponse(String resourceGroupName, String sqlServerInstanceName, + Context context) { + Response inner + = this.serviceClient().preUpgradeWithResponse(resourceGroupName, sqlServerInstanceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerInstanceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlServerInstance preUpgrade(String resourceGroupName, String sqlServerInstanceName) { + SqlServerInstanceInner inner = this.serviceClient().preUpgrade(resourceGroupName, sqlServerInstanceName); + if (inner != null) { + return new SqlServerInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response postUpgradeWithResponse(String resourceGroupName, String sqlServerInstanceName, + Context context) { + Response inner + = this.serviceClient().postUpgradeWithResponse(resourceGroupName, sqlServerInstanceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerInstanceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlServerInstance postUpgrade(String resourceGroupName, String sqlServerInstanceName) { + SqlServerInstanceInner inner = this.serviceClient().postUpgrade(resourceGroupName, sqlServerInstanceName); + if (inner != null) { + return new SqlServerInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + public SqlServerInstance getById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.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))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String sqlServerInstanceName = Utils.getValueFromIdByName(id, "sqlServerInstances"); + String sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); if (sqlServerInstanceName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format( - "The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); } return this.getByResourceGroupWithResponse(resourceGroupName, sqlServerInstanceName, Context.NONE).getValue(); } public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.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))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String sqlServerInstanceName = Utils.getValueFromIdByName(id, "sqlServerInstances"); + String sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); if (sqlServerInstanceName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format( - "The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); } return this.getByResourceGroupWithResponse(resourceGroupName, sqlServerInstanceName, context); } public void deleteById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.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))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String sqlServerInstanceName = Utils.getValueFromIdByName(id, "sqlServerInstances"); + String sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); if (sqlServerInstanceName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format( - "The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); } this.delete(resourceGroupName, sqlServerInstanceName, Context.NONE); } public void deleteByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.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))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String sqlServerInstanceName = Utils.getValueFromIdByName(id, "sqlServerInstances"); + String sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); if (sqlServerInstanceName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format( - "The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); } this.delete(resourceGroupName, sqlServerInstanceName, context); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicenseImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicenseImpl.java new file mode 100644 index 000000000000..bf0552353992 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicenseImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerLicenseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicense; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseUpdate; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseUpdateProperties; +import java.util.Collections; +import java.util.Map; + +public final class SqlServerLicenseImpl + implements SqlServerLicense, SqlServerLicense.Definition, SqlServerLicense.Update { + private SqlServerLicenseInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager 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 SqlServerLicenseProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SqlServerLicenseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sqlServerLicenseName; + + private SqlServerLicenseUpdate updateParameters; + + public SqlServerLicenseImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public SqlServerLicense create() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerLicenses() + .createWithResponse(resourceGroupName, sqlServerLicenseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SqlServerLicense create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerLicenses() + .createWithResponse(resourceGroupName, sqlServerLicenseName, this.innerModel(), context) + .getValue(); + return this; + } + + SqlServerLicenseImpl(String name, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new SqlServerLicenseInner(); + this.serviceManager = serviceManager; + this.sqlServerLicenseName = name; + } + + public SqlServerLicenseImpl update() { + this.updateParameters = new SqlServerLicenseUpdate(); + return this; + } + + public SqlServerLicense apply() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerLicenses() + .updateWithResponse(resourceGroupName, sqlServerLicenseName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public SqlServerLicense apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerLicenses() + .updateWithResponse(resourceGroupName, sqlServerLicenseName, updateParameters, context) + .getValue(); + return this; + } + + SqlServerLicenseImpl(SqlServerLicenseInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.sqlServerLicenseName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlServerLicenses"); + } + + public SqlServerLicense refresh() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerLicenses() + .getByResourceGroupWithResponse(resourceGroupName, sqlServerLicenseName, Context.NONE) + .getValue(); + return this; + } + + public SqlServerLicense refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerLicenses() + .getByResourceGroupWithResponse(resourceGroupName, sqlServerLicenseName, context) + .getValue(); + return this; + } + + public SqlServerLicenseImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SqlServerLicenseImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SqlServerLicenseImpl withProperties(SqlServerLicenseProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public SqlServerLicenseImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public SqlServerLicenseImpl withProperties(SqlServerLicenseUpdateProperties properties) { + this.updateParameters.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicensesClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicensesClientImpl.java new file mode 100644 index 000000000000..fc31e9721105 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicensesClientImpl.java @@ -0,0 +1,1019 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerLicensesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerLicenseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseListResult; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseUpdate; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SqlServerLicensesClient. + */ +public final class SqlServerLicensesClientImpl implements SqlServerLicensesClient { + /** + * The proxy service used to perform REST calls. + */ + private final SqlServerLicensesService service; + + /** + * The service client containing this operation class. + */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of SqlServerLicensesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlServerLicensesClientImpl(AzureArcDataManagementClientImpl client) { + this.service + = RestProxy.create(SqlServerLicensesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientSqlServerLicenses to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureArcDataManageme") + public interface SqlServerLicensesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlServerLicenses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerLicenses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerLicenses/{sqlServerLicenseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerLicenseName") String sqlServerLicenseName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerLicenses/{sqlServerLicenseName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerLicenseName") String sqlServerLicenseName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlServerLicenseInner sqlServerLicense, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerLicenses/{sqlServerLicenseName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerLicenseName") String sqlServerLicenseName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerLicenses/{sqlServerLicenseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerLicenseName") String sqlServerLicenseName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlServerLicenseUpdate parameters, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * List sqlServerLicense resources in the 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 SQL Server licenses 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.getSubscriptionId(), + this.client.getApiVersion(), 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 sqlServerLicense resources in the 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 SQL Server licenses 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.getSubscriptionId(), this.client.getApiVersion(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List sqlServerLicense resources in the 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 SQL Server licenses as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List sqlServerLicense resources in the 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 SQL Server licenses as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List sqlServerLicense resources in the 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 SQL Server licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List sqlServerLicense resources in the 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 SQL Server licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlServerLicenses in a resource group 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.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), 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 sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlServerLicenses in a resource group 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.getSubscriptionId(), resourceGroupName, + this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlServerLicenses in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlServerLicenses in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlServerLicenses in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlServerLicenses in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String sqlServerLicenseName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerLicenseName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerLicenseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerLicenseName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String sqlServerLicenseName, 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 (sqlServerLicenseName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerLicenseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerLicenseName, this.client.getApiVersion(), accept, context); + } + + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String sqlServerLicenseName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, sqlServerLicenseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerLicenseName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, sqlServerLicenseName, context).block(); + } + + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerLicenseInner getByResourceGroup(String resourceGroupName, String sqlServerLicenseName) { + return getByResourceGroupWithResponse(resourceGroupName, sqlServerLicenseName, Context.NONE).getValue(); + } + + /** + * Creates or replaces a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param sqlServerLicense The SQL Server license to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String sqlServerLicenseName, SqlServerLicenseInner sqlServerLicense) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerLicenseName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerLicenseName is required and cannot be null.")); + } + if (sqlServerLicense == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerLicense is required and cannot be null.")); + } else { + sqlServerLicense.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerLicenseName, this.client.getApiVersion(), sqlServerLicense, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param sqlServerLicense The SQL Server license to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String sqlServerLicenseName, SqlServerLicenseInner sqlServerLicense, 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 (sqlServerLicenseName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerLicenseName is required and cannot be null.")); + } + if (sqlServerLicense == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerLicense is required and cannot be null.")); + } else { + sqlServerLicense.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerLicenseName, this.client.getApiVersion(), sqlServerLicense, accept, context); + } + + /** + * Creates or replaces a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param sqlServerLicense The SQL Server license to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseInner sqlServerLicense) { + return createWithResponseAsync(resourceGroupName, sqlServerLicenseName, sqlServerLicense) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or replaces a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param sqlServerLicense The SQL Server license to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseInner sqlServerLicense, Context context) { + return createWithResponseAsync(resourceGroupName, sqlServerLicenseName, sqlServerLicense, context).block(); + } + + /** + * Creates or replaces a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param sqlServerLicense The SQL Server license to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerLicenseInner create(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseInner sqlServerLicense) { + return createWithResponse(resourceGroupName, sqlServerLicenseName, sqlServerLicense, Context.NONE).getValue(); + } + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 sqlServerLicenseName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and 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 (sqlServerLicenseName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerLicenseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerLicenseName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 sqlServerLicenseName, + 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 (sqlServerLicenseName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerLicenseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerLicenseName, this.client.getApiVersion(), accept, context); + } + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 sqlServerLicenseName) { + return deleteWithResponseAsync(resourceGroupName, sqlServerLicenseName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String sqlServerLicenseName, Context context) { + return deleteWithResponseAsync(resourceGroupName, sqlServerLicenseName, context).block(); + } + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 sqlServerLicenseName) { + deleteWithResponse(resourceGroupName, sqlServerLicenseName, Context.NONE); + } + + /** + * Updates a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param parameters The SQL Server license. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String sqlServerLicenseName, SqlServerLicenseUpdate 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 (sqlServerLicenseName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerLicenseName 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.getSubscriptionId(), + resourceGroupName, sqlServerLicenseName, this.client.getApiVersion(), parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param parameters The SQL Server license. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String sqlServerLicenseName, SqlServerLicenseUpdate 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 (sqlServerLicenseName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerLicenseName 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.getSubscriptionId(), resourceGroupName, + sqlServerLicenseName, this.client.getApiVersion(), parameters, accept, context); + } + + /** + * Updates a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param parameters The SQL Server license. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseUpdate parameters) { + return updateWithResponseAsync(resourceGroupName, sqlServerLicenseName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param parameters The SQL Server license. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseUpdate parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, sqlServerLicenseName, parameters, context).block(); + } + + /** + * Updates a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param parameters The SQL Server license. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerLicenseInner update(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseUpdate parameters) { + return updateWithResponse(resourceGroupName, sqlServerLicenseName, parameters, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses 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/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicensesImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicensesImpl.java new file mode 100644 index 000000000000..dc0fbdf87beb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicensesImpl.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.azurearcdata.fluent.SqlServerLicensesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerLicenseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicense; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenses; + +public final class SqlServerLicensesImpl implements SqlServerLicenses { + private static final ClientLogger LOGGER = new ClientLogger(SqlServerLicensesImpl.class); + + private final SqlServerLicensesClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public SqlServerLicensesImpl(SqlServerLicensesClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerLicenseImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerLicenseImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerLicenseImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerLicenseImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerLicenseName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, sqlServerLicenseName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerLicenseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlServerLicense getByResourceGroup(String resourceGroupName, String sqlServerLicenseName) { + SqlServerLicenseInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, sqlServerLicenseName); + if (inner != null) { + return new SqlServerLicenseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String sqlServerLicenseName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, sqlServerLicenseName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String sqlServerLicenseName) { + this.serviceClient().delete(resourceGroupName, sqlServerLicenseName); + } + + public SqlServerLicense getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 sqlServerLicenseName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerLicenses"); + if (sqlServerLicenseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerLicenses'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, sqlServerLicenseName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 sqlServerLicenseName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerLicenses"); + if (sqlServerLicenseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerLicenses'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, sqlServerLicenseName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.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 sqlServerLicenseName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerLicenses"); + if (sqlServerLicenseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerLicenses'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, sqlServerLicenseName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 sqlServerLicenseName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerLicenses"); + if (sqlServerLicenseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerLicenses'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, sqlServerLicenseName, context); + } + + private SqlServerLicensesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public SqlServerLicenseImpl define(String name) { + return new SqlServerLicenseImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/package-info.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/package-info.java index fc141afd38d4..af3137d36b15 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/package-info.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/package-info.java @@ -3,7 +3,8 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * Package containing the implementations for AzureArcDataManagementClient. The AzureArcData management API provides a - * RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. + * Package containing the implementations for AzureArcDataManagementClient. + * The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc + * Resources. */ package com.azure.resourcemanager.azurearcdata.implementation; diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AccountProvisioningMode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AccountProvisioningMode.java new file mode 100644 index 000000000000..ca1947b2154e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AccountProvisioningMode.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.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The service account provisioning mode for this Active Directory connector. + */ +public final class AccountProvisioningMode extends ExpandableStringEnum { + /** + * Static value automatic for AccountProvisioningMode. + */ + public static final AccountProvisioningMode AUTOMATIC = fromString("automatic"); + + /** + * Static value manual for AccountProvisioningMode. + */ + public static final AccountProvisioningMode MANUAL = fromString("manual"); + + /** + * Creates a new instance of AccountProvisioningMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AccountProvisioningMode() { + } + + /** + * Creates or finds a AccountProvisioningMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccountProvisioningMode. + */ + public static AccountProvisioningMode fromString(String name) { + return fromString(name, AccountProvisioningMode.class); + } + + /** + * Gets known AccountProvisioningMode values. + * + * @return known AccountProvisioningMode values. + */ + public static Collection values() { + return values(AccountProvisioningMode.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActivationState.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActivationState.java new file mode 100644 index 000000000000..b54dceb4e853 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActivationState.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.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The activation state of the license. + */ +public final class ActivationState extends ExpandableStringEnum { + /** + * Static value Activated for ActivationState. + */ + public static final ActivationState ACTIVATED = fromString("Activated"); + + /** + * Static value Deactivated for ActivationState. + */ + public static final ActivationState DEACTIVATED = fromString("Deactivated"); + + /** + * Creates a new instance of ActivationState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActivationState() { + } + + /** + * Creates or finds a ActivationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActivationState. + */ + public static ActivationState fromString(String name) { + return fromString(name, ActivationState.class); + } + + /** + * Gets known ActivationState values. + * + * @return known ActivationState values. + */ + public static Collection values() { + return values(ActivationState.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDnsDetails.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDnsDetails.java new file mode 100644 index 000000000000..10ce76539ae0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDnsDetails.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * DNS server details. + */ +@Fluent +public final class ActiveDirectoryConnectorDnsDetails implements JsonSerializable { + /* + * DNS domain name for which DNS lookups should be forwarded to the Active Directory DNS servers. + */ + private String domainName; + + /* + * List of Active Directory DNS server IP addresses. + */ + private List nameserverIpAddresses; + + /* + * Replica count for DNS proxy service. Default value is 1. + */ + private Long replicas; + + /* + * Flag indicating whether to prefer Kubernetes DNS server response over AD DNS server response for IP address + * lookups. + */ + private Boolean preferK8SDnsForPtrLookups; + + /** + * Creates an instance of ActiveDirectoryConnectorDnsDetails class. + */ + public ActiveDirectoryConnectorDnsDetails() { + } + + /** + * Get the domainName property: DNS domain name for which DNS lookups should be forwarded to the Active Directory + * DNS servers. + * + * @return the domainName value. + */ + public String domainName() { + return this.domainName; + } + + /** + * Set the domainName property: DNS domain name for which DNS lookups should be forwarded to the Active Directory + * DNS servers. + * + * @param domainName the domainName value to set. + * @return the ActiveDirectoryConnectorDnsDetails object itself. + */ + public ActiveDirectoryConnectorDnsDetails withDomainName(String domainName) { + this.domainName = domainName; + return this; + } + + /** + * Get the nameserverIpAddresses property: List of Active Directory DNS server IP addresses. + * + * @return the nameserverIpAddresses value. + */ + public List nameserverIpAddresses() { + return this.nameserverIpAddresses; + } + + /** + * Set the nameserverIpAddresses property: List of Active Directory DNS server IP addresses. + * + * @param nameserverIpAddresses the nameserverIpAddresses value to set. + * @return the ActiveDirectoryConnectorDnsDetails object itself. + */ + public ActiveDirectoryConnectorDnsDetails withNameserverIpAddresses(List nameserverIpAddresses) { + this.nameserverIpAddresses = nameserverIpAddresses; + return this; + } + + /** + * Get the replicas property: Replica count for DNS proxy service. Default value is 1. + * + * @return the replicas value. + */ + public Long replicas() { + return this.replicas; + } + + /** + * Set the replicas property: Replica count for DNS proxy service. Default value is 1. + * + * @param replicas the replicas value to set. + * @return the ActiveDirectoryConnectorDnsDetails object itself. + */ + public ActiveDirectoryConnectorDnsDetails withReplicas(Long replicas) { + this.replicas = replicas; + return this; + } + + /** + * Get the preferK8SDnsForPtrLookups property: Flag indicating whether to prefer Kubernetes DNS server response over + * AD DNS server response for IP address lookups. + * + * @return the preferK8SDnsForPtrLookups value. + */ + public Boolean preferK8SDnsForPtrLookups() { + return this.preferK8SDnsForPtrLookups; + } + + /** + * Set the preferK8SDnsForPtrLookups property: Flag indicating whether to prefer Kubernetes DNS server response over + * AD DNS server response for IP address lookups. + * + * @param preferK8SDnsForPtrLookups the preferK8SDnsForPtrLookups value to set. + * @return the ActiveDirectoryConnectorDnsDetails object itself. + */ + public ActiveDirectoryConnectorDnsDetails withPreferK8SDnsForPtrLookups(Boolean preferK8SDnsForPtrLookups) { + this.preferK8SDnsForPtrLookups = preferK8SDnsForPtrLookups; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (nameserverIpAddresses() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property nameserverIpAddresses in model ActiveDirectoryConnectorDnsDetails")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActiveDirectoryConnectorDnsDetails.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("nameserverIPAddresses", this.nameserverIpAddresses, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("domainName", this.domainName); + jsonWriter.writeNumberField("replicas", this.replicas); + jsonWriter.writeBooleanField("preferK8sDnsForPtrLookups", this.preferK8SDnsForPtrLookups); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryConnectorDnsDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryConnectorDnsDetails if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActiveDirectoryConnectorDnsDetails. + */ + public static ActiveDirectoryConnectorDnsDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryConnectorDnsDetails deserializedActiveDirectoryConnectorDnsDetails + = new ActiveDirectoryConnectorDnsDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nameserverIPAddresses".equals(fieldName)) { + List nameserverIpAddresses = reader.readArray(reader1 -> reader1.getString()); + deserializedActiveDirectoryConnectorDnsDetails.nameserverIpAddresses = nameserverIpAddresses; + } else if ("domainName".equals(fieldName)) { + deserializedActiveDirectoryConnectorDnsDetails.domainName = reader.getString(); + } else if ("replicas".equals(fieldName)) { + deserializedActiveDirectoryConnectorDnsDetails.replicas = reader.getNullable(JsonReader::getLong); + } else if ("preferK8sDnsForPtrLookups".equals(fieldName)) { + deserializedActiveDirectoryConnectorDnsDetails.preferK8SDnsForPtrLookups + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryConnectorDnsDetails; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDomainDetails.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDomainDetails.java new file mode 100644 index 000000000000..b3f773a9ff0b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDomainDetails.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Active Directory domain details. + */ +@Fluent +public final class ActiveDirectoryConnectorDomainDetails + implements JsonSerializable { + /* + * Name (uppercase) of the Active Directory domain that this AD connector will be associated with. + */ + private String realm; + + /* + * NETBIOS name of the Active Directory domain. + */ + private String netbiosDomainName; + + /* + * The service account provisioning mode for this Active Directory connector. + */ + private AccountProvisioningMode serviceAccountProvisioning; + + /* + * The distinguished name of the Active Directory Organizational Unit. + */ + private String ouDistinguishedName; + + /* + * null + */ + private ActiveDirectoryDomainControllers domainControllers; + + /** + * Creates an instance of ActiveDirectoryConnectorDomainDetails class. + */ + public ActiveDirectoryConnectorDomainDetails() { + } + + /** + * Get the realm property: Name (uppercase) of the Active Directory domain that this AD connector will be associated + * with. + * + * @return the realm value. + */ + public String realm() { + return this.realm; + } + + /** + * Set the realm property: Name (uppercase) of the Active Directory domain that this AD connector will be associated + * with. + * + * @param realm the realm value to set. + * @return the ActiveDirectoryConnectorDomainDetails object itself. + */ + public ActiveDirectoryConnectorDomainDetails withRealm(String realm) { + this.realm = realm; + return this; + } + + /** + * Get the netbiosDomainName property: NETBIOS name of the Active Directory domain. + * + * @return the netbiosDomainName value. + */ + public String netbiosDomainName() { + return this.netbiosDomainName; + } + + /** + * Set the netbiosDomainName property: NETBIOS name of the Active Directory domain. + * + * @param netbiosDomainName the netbiosDomainName value to set. + * @return the ActiveDirectoryConnectorDomainDetails object itself. + */ + public ActiveDirectoryConnectorDomainDetails withNetbiosDomainName(String netbiosDomainName) { + this.netbiosDomainName = netbiosDomainName; + return this; + } + + /** + * Get the serviceAccountProvisioning property: The service account provisioning mode for this Active Directory + * connector. + * + * @return the serviceAccountProvisioning value. + */ + public AccountProvisioningMode serviceAccountProvisioning() { + return this.serviceAccountProvisioning; + } + + /** + * Set the serviceAccountProvisioning property: The service account provisioning mode for this Active Directory + * connector. + * + * @param serviceAccountProvisioning the serviceAccountProvisioning value to set. + * @return the ActiveDirectoryConnectorDomainDetails object itself. + */ + public ActiveDirectoryConnectorDomainDetails + withServiceAccountProvisioning(AccountProvisioningMode serviceAccountProvisioning) { + this.serviceAccountProvisioning = serviceAccountProvisioning; + return this; + } + + /** + * Get the ouDistinguishedName property: The distinguished name of the Active Directory Organizational Unit. + * + * @return the ouDistinguishedName value. + */ + public String ouDistinguishedName() { + return this.ouDistinguishedName; + } + + /** + * Set the ouDistinguishedName property: The distinguished name of the Active Directory Organizational Unit. + * + * @param ouDistinguishedName the ouDistinguishedName value to set. + * @return the ActiveDirectoryConnectorDomainDetails object itself. + */ + public ActiveDirectoryConnectorDomainDetails withOuDistinguishedName(String ouDistinguishedName) { + this.ouDistinguishedName = ouDistinguishedName; + return this; + } + + /** + * Get the domainControllers property: null. + * + * @return the domainControllers value. + */ + public ActiveDirectoryDomainControllers domainControllers() { + return this.domainControllers; + } + + /** + * Set the domainControllers property: null. + * + * @param domainControllers the domainControllers value to set. + * @return the ActiveDirectoryConnectorDomainDetails object itself. + */ + public ActiveDirectoryConnectorDomainDetails + withDomainControllers(ActiveDirectoryDomainControllers domainControllers) { + this.domainControllers = domainControllers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (realm() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property realm in model ActiveDirectoryConnectorDomainDetails")); + } + if (domainControllers() != null) { + domainControllers().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActiveDirectoryConnectorDomainDetails.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("realm", this.realm); + jsonWriter.writeStringField("netbiosDomainName", this.netbiosDomainName); + jsonWriter.writeStringField("serviceAccountProvisioning", + this.serviceAccountProvisioning == null ? null : this.serviceAccountProvisioning.toString()); + jsonWriter.writeStringField("ouDistinguishedName", this.ouDistinguishedName); + jsonWriter.writeJsonField("domainControllers", this.domainControllers); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryConnectorDomainDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryConnectorDomainDetails if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActiveDirectoryConnectorDomainDetails. + */ + public static ActiveDirectoryConnectorDomainDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryConnectorDomainDetails deserializedActiveDirectoryConnectorDomainDetails + = new ActiveDirectoryConnectorDomainDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("realm".equals(fieldName)) { + deserializedActiveDirectoryConnectorDomainDetails.realm = reader.getString(); + } else if ("netbiosDomainName".equals(fieldName)) { + deserializedActiveDirectoryConnectorDomainDetails.netbiosDomainName = reader.getString(); + } else if ("serviceAccountProvisioning".equals(fieldName)) { + deserializedActiveDirectoryConnectorDomainDetails.serviceAccountProvisioning + = AccountProvisioningMode.fromString(reader.getString()); + } else if ("ouDistinguishedName".equals(fieldName)) { + deserializedActiveDirectoryConnectorDomainDetails.ouDistinguishedName = reader.getString(); + } else if ("domainControllers".equals(fieldName)) { + deserializedActiveDirectoryConnectorDomainDetails.domainControllers + = ActiveDirectoryDomainControllers.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryConnectorDomainDetails; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorListResult.java new file mode 100644 index 000000000000..d31ae10c5606 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorListResult.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.fluent.models.ActiveDirectoryConnectorResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of active directory connectors. + */ +@Immutable +public final class ActiveDirectoryConnectorListResult implements JsonSerializable { + /* + * Array of results. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of ActiveDirectoryConnectorListResult class. + */ + public ActiveDirectoryConnectorListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryConnectorListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryConnectorListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ActiveDirectoryConnectorListResult. + */ + public static ActiveDirectoryConnectorListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryConnectorListResult deserializedActiveDirectoryConnectorListResult + = new ActiveDirectoryConnectorListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ActiveDirectoryConnectorResourceInner.fromJson(reader1)); + deserializedActiveDirectoryConnectorListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedActiveDirectoryConnectorListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryConnectorListResult; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorProperties.java new file mode 100644 index 000000000000..16b931fcbee7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorProperties.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of an Active Directory connector resource. + */ +@Fluent +public final class ActiveDirectoryConnectorProperties implements JsonSerializable { + /* + * Username and password for domain service account authentication. + */ + private BasicLoginInformation domainServiceAccountLoginInformation; + + /* + * The provisioning state of the Active Directory connector resource. + */ + private String provisioningState; + + /* + * null + */ + private ActiveDirectoryConnectorSpec spec; + + /* + * null + */ + private ActiveDirectoryConnectorStatus status; + + /** + * Creates an instance of ActiveDirectoryConnectorProperties class. + */ + public ActiveDirectoryConnectorProperties() { + } + + /** + * Get the domainServiceAccountLoginInformation property: Username and password for domain service account + * authentication. + * + * @return the domainServiceAccountLoginInformation value. + */ + public BasicLoginInformation domainServiceAccountLoginInformation() { + return this.domainServiceAccountLoginInformation; + } + + /** + * Set the domainServiceAccountLoginInformation property: Username and password for domain service account + * authentication. + * + * @param domainServiceAccountLoginInformation the domainServiceAccountLoginInformation value to set. + * @return the ActiveDirectoryConnectorProperties object itself. + */ + public ActiveDirectoryConnectorProperties + withDomainServiceAccountLoginInformation(BasicLoginInformation domainServiceAccountLoginInformation) { + this.domainServiceAccountLoginInformation = domainServiceAccountLoginInformation; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the Active Directory connector resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the spec property: null. + * + * @return the spec value. + */ + public ActiveDirectoryConnectorSpec spec() { + return this.spec; + } + + /** + * Set the spec property: null. + * + * @param spec the spec value to set. + * @return the ActiveDirectoryConnectorProperties object itself. + */ + public ActiveDirectoryConnectorProperties withSpec(ActiveDirectoryConnectorSpec spec) { + this.spec = spec; + return this; + } + + /** + * Get the status property: null. + * + * @return the status value. + */ + public ActiveDirectoryConnectorStatus status() { + return this.status; + } + + /** + * Set the status property: null. + * + * @param status the status value to set. + * @return the ActiveDirectoryConnectorProperties object itself. + */ + public ActiveDirectoryConnectorProperties withStatus(ActiveDirectoryConnectorStatus status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (domainServiceAccountLoginInformation() != null) { + domainServiceAccountLoginInformation().validate(); + } + if (spec() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property spec in model ActiveDirectoryConnectorProperties")); + } else { + spec().validate(); + } + if (status() != null) { + status().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActiveDirectoryConnectorProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("spec", this.spec); + jsonWriter.writeJsonField("domainServiceAccountLoginInformation", this.domainServiceAccountLoginInformation); + jsonWriter.writeJsonField("status", this.status); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryConnectorProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActiveDirectoryConnectorProperties. + */ + public static ActiveDirectoryConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryConnectorProperties deserializedActiveDirectoryConnectorProperties + = new ActiveDirectoryConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("spec".equals(fieldName)) { + deserializedActiveDirectoryConnectorProperties.spec = ActiveDirectoryConnectorSpec.fromJson(reader); + } else if ("domainServiceAccountLoginInformation".equals(fieldName)) { + deserializedActiveDirectoryConnectorProperties.domainServiceAccountLoginInformation + = BasicLoginInformation.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedActiveDirectoryConnectorProperties.provisioningState = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedActiveDirectoryConnectorProperties.status + = ActiveDirectoryConnectorStatus.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryConnectorProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorResource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorResource.java new file mode 100644 index 000000000000..91102237c829 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorResource.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.ActiveDirectoryConnectorResourceInner; + +/** + * An immutable client-side representation of ActiveDirectoryConnectorResource. + */ +public interface ActiveDirectoryConnectorResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: null. + * + * @return the properties value. + */ + ActiveDirectoryConnectorProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.azurearcdata.fluent.models.ActiveDirectoryConnectorResourceInner object. + * + * @return the inner object. + */ + ActiveDirectoryConnectorResourceInner innerModel(); + + /** + * The entirety of the ActiveDirectoryConnectorResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, + DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * The ActiveDirectoryConnectorResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ActiveDirectoryConnectorResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the ActiveDirectoryConnectorResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, dataControllerName. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @return the next definition stage. + */ + WithProperties withExistingDataController(String resourceGroupName, String dataControllerName); + } + + /** + * The stage of the ActiveDirectoryConnectorResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: null. + * + * @param properties null. + * @return the next definition stage. + */ + WithCreate withProperties(ActiveDirectoryConnectorProperties properties); + } + + /** + * The stage of the ActiveDirectoryConnectorResource 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. + */ + ActiveDirectoryConnectorResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ActiveDirectoryConnectorResource create(Context context); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ActiveDirectoryConnectorResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ActiveDirectoryConnectorResource refresh(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorSpec.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorSpec.java new file mode 100644 index 000000000000..85ef26db3e36 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorSpec.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The specifications of the AD Kubernetes resource. + */ +@Fluent +public final class ActiveDirectoryConnectorSpec implements JsonSerializable { + /* + * null + */ + private ActiveDirectoryConnectorDomainDetails activeDirectory; + + /* + * null + */ + private ActiveDirectoryConnectorDnsDetails dns; + + /** + * Creates an instance of ActiveDirectoryConnectorSpec class. + */ + public ActiveDirectoryConnectorSpec() { + } + + /** + * Get the activeDirectory property: null. + * + * @return the activeDirectory value. + */ + public ActiveDirectoryConnectorDomainDetails activeDirectory() { + return this.activeDirectory; + } + + /** + * Set the activeDirectory property: null. + * + * @param activeDirectory the activeDirectory value to set. + * @return the ActiveDirectoryConnectorSpec object itself. + */ + public ActiveDirectoryConnectorSpec withActiveDirectory(ActiveDirectoryConnectorDomainDetails activeDirectory) { + this.activeDirectory = activeDirectory; + return this; + } + + /** + * Get the dns property: null. + * + * @return the dns value. + */ + public ActiveDirectoryConnectorDnsDetails dns() { + return this.dns; + } + + /** + * Set the dns property: null. + * + * @param dns the dns value to set. + * @return the ActiveDirectoryConnectorSpec object itself. + */ + public ActiveDirectoryConnectorSpec withDns(ActiveDirectoryConnectorDnsDetails dns) { + this.dns = dns; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (activeDirectory() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property activeDirectory in model ActiveDirectoryConnectorSpec")); + } else { + activeDirectory().validate(); + } + if (dns() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dns in model ActiveDirectoryConnectorSpec")); + } else { + dns().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActiveDirectoryConnectorSpec.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("activeDirectory", this.activeDirectory); + jsonWriter.writeJsonField("dns", this.dns); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryConnectorSpec from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryConnectorSpec if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActiveDirectoryConnectorSpec. + */ + public static ActiveDirectoryConnectorSpec fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryConnectorSpec deserializedActiveDirectoryConnectorSpec = new ActiveDirectoryConnectorSpec(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("activeDirectory".equals(fieldName)) { + deserializedActiveDirectoryConnectorSpec.activeDirectory + = ActiveDirectoryConnectorDomainDetails.fromJson(reader); + } else if ("dns".equals(fieldName)) { + deserializedActiveDirectoryConnectorSpec.dns = ActiveDirectoryConnectorDnsDetails.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryConnectorSpec; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorStatus.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorStatus.java new file mode 100644 index 000000000000..71b0d3016585 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorStatus.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.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The status of the Kubernetes custom resource. + */ +@Fluent +public final class ActiveDirectoryConnectorStatus implements JsonSerializable { + /* + * The time that the custom resource was last updated. + */ + private String lastUpdateTime; + + /* + * The version of the replicaSet associated with the AD connector custom resource. + */ + private Long observedGeneration; + + /* + * The state of the AD connector custom resource. + */ + private String state; + + /* + * The status of the Kubernetes custom resource. + */ + private Map additionalProperties; + + /** + * Creates an instance of ActiveDirectoryConnectorStatus class. + */ + public ActiveDirectoryConnectorStatus() { + } + + /** + * Get the lastUpdateTime property: The time that the custom resource was last updated. + * + * @return the lastUpdateTime value. + */ + public String lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Set the lastUpdateTime property: The time that the custom resource was last updated. + * + * @param lastUpdateTime the lastUpdateTime value to set. + * @return the ActiveDirectoryConnectorStatus object itself. + */ + public ActiveDirectoryConnectorStatus withLastUpdateTime(String lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + return this; + } + + /** + * Get the observedGeneration property: The version of the replicaSet associated with the AD connector custom + * resource. + * + * @return the observedGeneration value. + */ + public Long observedGeneration() { + return this.observedGeneration; + } + + /** + * Set the observedGeneration property: The version of the replicaSet associated with the AD connector custom + * resource. + * + * @param observedGeneration the observedGeneration value to set. + * @return the ActiveDirectoryConnectorStatus object itself. + */ + public ActiveDirectoryConnectorStatus withObservedGeneration(Long observedGeneration) { + this.observedGeneration = observedGeneration; + return this; + } + + /** + * Get the state property: The state of the AD connector custom resource. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Set the state property: The state of the AD connector custom resource. + * + * @param state the state value to set. + * @return the ActiveDirectoryConnectorStatus object itself. + */ + public ActiveDirectoryConnectorStatus withState(String state) { + this.state = state; + return this; + } + + /** + * Get the additionalProperties property: The status of the Kubernetes custom resource. + * + * @return the additionalProperties value. + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The status of the Kubernetes custom resource. + * + * @param additionalProperties the additionalProperties value to set. + * @return the ActiveDirectoryConnectorStatus object itself. + */ + public ActiveDirectoryConnectorStatus withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("lastUpdateTime", this.lastUpdateTime); + jsonWriter.writeNumberField("observedGeneration", this.observedGeneration); + jsonWriter.writeStringField("state", this.state); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryConnectorStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryConnectorStatus if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ActiveDirectoryConnectorStatus. + */ + public static ActiveDirectoryConnectorStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryConnectorStatus deserializedActiveDirectoryConnectorStatus + = new ActiveDirectoryConnectorStatus(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("lastUpdateTime".equals(fieldName)) { + deserializedActiveDirectoryConnectorStatus.lastUpdateTime = reader.getString(); + } else if ("observedGeneration".equals(fieldName)) { + deserializedActiveDirectoryConnectorStatus.observedGeneration + = reader.getNullable(JsonReader::getLong); + } else if ("state".equals(fieldName)) { + deserializedActiveDirectoryConnectorStatus.state = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedActiveDirectoryConnectorStatus.additionalProperties = additionalProperties; + + return deserializedActiveDirectoryConnectorStatus; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectors.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectors.java new file mode 100644 index 000000000000..70cadf570807 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectors.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.azurearcdata.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 ActiveDirectoryConnectors. + */ +public interface ActiveDirectoryConnectors { + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String dataControllerName); + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String dataControllerName, + Context context); + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 dataControllerName, String activeDirectoryConnectorName); + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 dataControllerName, String activeDirectoryConnectorName, + Context context); + + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, Context context); + + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource. + */ + ActiveDirectoryConnectorResource get(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName); + + /** + * Retrieves an Active Directory connector resource. + * + * @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 active directory connector resource along with {@link Response}. + */ + ActiveDirectoryConnectorResource getById(String id); + + /** + * Retrieves an Active Directory connector resource. + * + * @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 active directory connector resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an Active Directory connector resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an Active Directory connector resource. + * + * @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 ActiveDirectoryConnectorResource resource. + * + * @param name resource name. + * @return the first stage of the new ActiveDirectoryConnectorResource definition. + */ + ActiveDirectoryConnectorResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainController.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainController.java new file mode 100644 index 000000000000..0af6ec08cc44 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainController.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Information about a domain controller in the AD domain. + */ +@Fluent +public final class ActiveDirectoryDomainController implements JsonSerializable { + /* + * Fully-qualified domain name of a domain controller in the AD domain. + */ + private String hostname; + + /** + * Creates an instance of ActiveDirectoryDomainController class. + */ + public ActiveDirectoryDomainController() { + } + + /** + * Get the hostname property: Fully-qualified domain name of a domain controller in the AD domain. + * + * @return the hostname value. + */ + public String hostname() { + return this.hostname; + } + + /** + * Set the hostname property: Fully-qualified domain name of a domain controller in the AD domain. + * + * @param hostname the hostname value to set. + * @return the ActiveDirectoryDomainController object itself. + */ + public ActiveDirectoryDomainController withHostname(String hostname) { + this.hostname = hostname; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (hostname() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property hostname in model ActiveDirectoryDomainController")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActiveDirectoryDomainController.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("hostname", this.hostname); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryDomainController from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryDomainController if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActiveDirectoryDomainController. + */ + public static ActiveDirectoryDomainController fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryDomainController deserializedActiveDirectoryDomainController + = new ActiveDirectoryDomainController(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("hostname".equals(fieldName)) { + deserializedActiveDirectoryDomainController.hostname = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryDomainController; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainControllers.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainControllers.java new file mode 100644 index 000000000000..f5c9d96b39d2 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainControllers.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Details about the Active Directory domain controllers associated with this AD connector instance. + */ +@Fluent +public final class ActiveDirectoryDomainControllers implements JsonSerializable { + /* + * Information about the Primary Domain Controller (PDC) in the AD domain. + */ + private ActiveDirectoryDomainController primaryDomainController; + + /* + * null + */ + private List secondaryDomainControllers; + + /** + * Creates an instance of ActiveDirectoryDomainControllers class. + */ + public ActiveDirectoryDomainControllers() { + } + + /** + * Get the primaryDomainController property: Information about the Primary Domain Controller (PDC) in the AD domain. + * + * @return the primaryDomainController value. + */ + public ActiveDirectoryDomainController primaryDomainController() { + return this.primaryDomainController; + } + + /** + * Set the primaryDomainController property: Information about the Primary Domain Controller (PDC) in the AD domain. + * + * @param primaryDomainController the primaryDomainController value to set. + * @return the ActiveDirectoryDomainControllers object itself. + */ + public ActiveDirectoryDomainControllers + withPrimaryDomainController(ActiveDirectoryDomainController primaryDomainController) { + this.primaryDomainController = primaryDomainController; + return this; + } + + /** + * Get the secondaryDomainControllers property: null. + * + * @return the secondaryDomainControllers value. + */ + public List secondaryDomainControllers() { + return this.secondaryDomainControllers; + } + + /** + * Set the secondaryDomainControllers property: null. + * + * @param secondaryDomainControllers the secondaryDomainControllers value to set. + * @return the ActiveDirectoryDomainControllers object itself. + */ + public ActiveDirectoryDomainControllers + withSecondaryDomainControllers(List secondaryDomainControllers) { + this.secondaryDomainControllers = secondaryDomainControllers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (primaryDomainController() != null) { + primaryDomainController().validate(); + } + if (secondaryDomainControllers() != null) { + secondaryDomainControllers().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("primaryDomainController", this.primaryDomainController); + jsonWriter.writeArrayField("secondaryDomainControllers", this.secondaryDomainControllers, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryDomainControllers from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryDomainControllers if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ActiveDirectoryDomainControllers. + */ + public static ActiveDirectoryDomainControllers fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryDomainControllers deserializedActiveDirectoryDomainControllers + = new ActiveDirectoryDomainControllers(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("primaryDomainController".equals(fieldName)) { + deserializedActiveDirectoryDomainControllers.primaryDomainController + = ActiveDirectoryDomainController.fromJson(reader); + } else if ("secondaryDomainControllers".equals(fieldName)) { + List secondaryDomainControllers + = reader.readArray(reader1 -> ActiveDirectoryDomainController.fromJson(reader1)); + deserializedActiveDirectoryDomainControllers.secondaryDomainControllers + = secondaryDomainControllers; + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryDomainControllers; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryInformation.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryInformation.java new file mode 100644 index 000000000000..148d07b15731 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryInformation.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Active Directory information that related to the resource. + */ +@Fluent +public final class ActiveDirectoryInformation implements JsonSerializable { + /* + * Keytab information that is used for the Sql Managed Instance when Active Directory authentication is used. + */ + private KeytabInformation keytabInformation; + + /** + * Creates an instance of ActiveDirectoryInformation class. + */ + public ActiveDirectoryInformation() { + } + + /** + * Get the keytabInformation property: Keytab information that is used for the Sql Managed Instance when Active + * Directory authentication is used. + * + * @return the keytabInformation value. + */ + public KeytabInformation keytabInformation() { + return this.keytabInformation; + } + + /** + * Set the keytabInformation property: Keytab information that is used for the Sql Managed Instance when Active + * Directory authentication is used. + * + * @param keytabInformation the keytabInformation value to set. + * @return the ActiveDirectoryInformation object itself. + */ + public ActiveDirectoryInformation withKeytabInformation(KeytabInformation keytabInformation) { + this.keytabInformation = keytabInformation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keytabInformation() != null) { + keytabInformation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("keytabInformation", this.keytabInformation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryInformation if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ActiveDirectoryInformation. + */ + public static ActiveDirectoryInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryInformation deserializedActiveDirectoryInformation = new ActiveDirectoryInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keytabInformation".equals(fieldName)) { + deserializedActiveDirectoryInformation.keytabInformation = KeytabInformation.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryInformation; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AggregationType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AggregationType.java new file mode 100644 index 000000000000..4ace5efd4b26 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AggregationType.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The aggregation type to use for the numerical columns in the dataset. + */ +public final class AggregationType extends ExpandableStringEnum { + /** + * Static value Average for AggregationType. + */ + public static final AggregationType AVERAGE = fromString("Average"); + + /** + * Static value Minimum for AggregationType. + */ + public static final AggregationType MINIMUM = fromString("Minimum"); + + /** + * Static value Maximum for AggregationType. + */ + public static final AggregationType MAXIMUM = fromString("Maximum"); + + /** + * Static value Sum for AggregationType. + */ + public static final AggregationType SUM = fromString("Sum"); + + /** + * Static value Count for AggregationType. + */ + public static final AggregationType COUNT = fromString("Count"); + + /** + * Creates a new instance of AggregationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AggregationType() { + } + + /** + * Creates or finds a AggregationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AggregationType. + */ + public static AggregationType fromString(String name) { + return fromString(name, AggregationType.class); + } + + /** + * Gets known AggregationType values. + * + * @return known AggregationType values. + */ + public static Collection values() { + return values(AggregationType.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AlwaysOnRole.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AlwaysOnRole.java new file mode 100644 index 000000000000..d94ef239a6b4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AlwaysOnRole.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The role of the SQL Server, based on availability. + */ +public final class AlwaysOnRole extends ExpandableStringEnum { + /** + * Static value None for AlwaysOnRole. + */ + public static final AlwaysOnRole NONE = fromString("None"); + + /** + * Static value FailoverClusterInstance for AlwaysOnRole. + */ + public static final AlwaysOnRole FAILOVER_CLUSTER_INSTANCE = fromString("FailoverClusterInstance"); + + /** + * Static value FailoverClusterNode for AlwaysOnRole. + */ + public static final AlwaysOnRole FAILOVER_CLUSTER_NODE = fromString("FailoverClusterNode"); + + /** + * Static value AvailabilityGroupReplica for AlwaysOnRole. + */ + public static final AlwaysOnRole AVAILABILITY_GROUP_REPLICA = fromString("AvailabilityGroupReplica"); + + /** + * Creates a new instance of AlwaysOnRole value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AlwaysOnRole() { + } + + /** + * Creates or finds a AlwaysOnRole from its string representation. + * + * @param name a name to look for. + * @return the corresponding AlwaysOnRole. + */ + public static AlwaysOnRole fromString(String name) { + return fromString(name, AlwaysOnRole.class); + } + + /** + * Gets known AlwaysOnRole values. + * + * @return known AlwaysOnRole values. + */ + public static Collection values() { + return values(AlwaysOnRole.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlManagedInstanceLicenseType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlManagedInstanceLicenseType.java index c2173cf8215f..640a3db339b3 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlManagedInstanceLicenseType.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlManagedInstanceLicenseType.java @@ -4,48 +4,53 @@ package com.azure.resourcemanager.azurearcdata.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; -/** The license type to apply for this managed instance. */ -public enum ArcSqlManagedInstanceLicenseType { - /** Enum value BasePrice. */ - BASE_PRICE("BasePrice"), +/** + * The license type to apply for this managed instance. + */ +public final class ArcSqlManagedInstanceLicenseType extends ExpandableStringEnum { + /** + * Static value BasePrice for ArcSqlManagedInstanceLicenseType. + */ + public static final ArcSqlManagedInstanceLicenseType BASE_PRICE = fromString("BasePrice"); - /** Enum value LicenseIncluded. */ - LICENSE_INCLUDED("LicenseIncluded"); + /** + * Static value LicenseIncluded for ArcSqlManagedInstanceLicenseType. + */ + public static final ArcSqlManagedInstanceLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); - /** The actual serialized value for a ArcSqlManagedInstanceLicenseType instance. */ - private final String value; + /** + * Static value DisasterRecovery for ArcSqlManagedInstanceLicenseType. + */ + public static final ArcSqlManagedInstanceLicenseType DISASTER_RECOVERY = fromString("DisasterRecovery"); - ArcSqlManagedInstanceLicenseType(String value) { - this.value = value; + /** + * Creates a new instance of ArcSqlManagedInstanceLicenseType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ArcSqlManagedInstanceLicenseType() { } /** - * Parses a serialized value to a ArcSqlManagedInstanceLicenseType instance. - * - * @param value the serialized value to parse. - * @return the parsed ArcSqlManagedInstanceLicenseType object, or null if unable to parse. + * Creates or finds a ArcSqlManagedInstanceLicenseType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ArcSqlManagedInstanceLicenseType. */ - @JsonCreator - public static ArcSqlManagedInstanceLicenseType fromString(String value) { - if (value == null) { - return null; - } - ArcSqlManagedInstanceLicenseType[] items = ArcSqlManagedInstanceLicenseType.values(); - for (ArcSqlManagedInstanceLicenseType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static ArcSqlManagedInstanceLicenseType fromString(String name) { + return fromString(name, ArcSqlManagedInstanceLicenseType.class); } - /** {@inheritDoc} */ - @JsonValue - @Override - public String toString() { - return this.value; + /** + * Gets known ArcSqlManagedInstanceLicenseType values. + * + * @return known ArcSqlManagedInstanceLicenseType values. + */ + public static Collection values() { + return values(ArcSqlManagedInstanceLicenseType.class); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityGroupListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityGroupListResult.java new file mode 100644 index 000000000000..c9543b97b97b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityGroupListResult.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.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of Arc Sql Server Availability Groups. + */ +@Immutable +public final class ArcSqlServerAvailabilityGroupListResult + implements JsonSerializable { + /* + * Array of Arc Sql Server Availability Groups. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of ArcSqlServerAvailabilityGroupListResult class. + */ + public ArcSqlServerAvailabilityGroupListResult() { + } + + /** + * Get the value property: Array of Arc Sql Server Availability Groups. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ArcSqlServerAvailabilityGroupListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ArcSqlServerAvailabilityGroupListResult if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ArcSqlServerAvailabilityGroupListResult. + */ + public static ArcSqlServerAvailabilityGroupListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ArcSqlServerAvailabilityGroupListResult deserializedArcSqlServerAvailabilityGroupListResult + = new ArcSqlServerAvailabilityGroupListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlServerAvailabilityGroupResourceInner.fromJson(reader1)); + deserializedArcSqlServerAvailabilityGroupListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedArcSqlServerAvailabilityGroupListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedArcSqlServerAvailabilityGroupListResult; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityMode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityMode.java new file mode 100644 index 000000000000..aec921a5055c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityMode.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.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Property that determines whether a given availability replica can run in synchronous-commit mode. + */ +public final class ArcSqlServerAvailabilityMode extends ExpandableStringEnum { + /** + * Static value SYNCHRONOUS_COMMIT for ArcSqlServerAvailabilityMode. + */ + public static final ArcSqlServerAvailabilityMode SYNCHRONOUS_COMMIT = fromString("SYNCHRONOUS_COMMIT"); + + /** + * Static value ASYNCHRONOUS_COMMIT for ArcSqlServerAvailabilityMode. + */ + public static final ArcSqlServerAvailabilityMode ASYNCHRONOUS_COMMIT = fromString("ASYNCHRONOUS_COMMIT"); + + /** + * Creates a new instance of ArcSqlServerAvailabilityMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ArcSqlServerAvailabilityMode() { + } + + /** + * Creates or finds a ArcSqlServerAvailabilityMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ArcSqlServerAvailabilityMode. + */ + public static ArcSqlServerAvailabilityMode fromString(String name) { + return fromString(name, ArcSqlServerAvailabilityMode.class); + } + + /** + * Gets known ArcSqlServerAvailabilityMode values. + * + * @return known ArcSqlServerAvailabilityMode values. + */ + public static Collection values() { + return values(ArcSqlServerAvailabilityMode.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerDatabaseListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerDatabaseListResult.java new file mode 100644 index 000000000000..fdeb4a8041e1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerDatabaseListResult.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerDatabaseResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of Arc Sql Server database. + */ +@Immutable +public final class ArcSqlServerDatabaseListResult implements JsonSerializable { + /* + * Array of Arc Sql Server database. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of ArcSqlServerDatabaseListResult class. + */ + public ArcSqlServerDatabaseListResult() { + } + + /** + * Get the value property: Array of Arc Sql Server database. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ArcSqlServerDatabaseListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ArcSqlServerDatabaseListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ArcSqlServerDatabaseListResult. + */ + public static ArcSqlServerDatabaseListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ArcSqlServerDatabaseListResult deserializedArcSqlServerDatabaseListResult + = new ArcSqlServerDatabaseListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlServerDatabaseResourceInner.fromJson(reader1)); + deserializedArcSqlServerDatabaseListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedArcSqlServerDatabaseListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedArcSqlServerDatabaseListResult; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerFailoverMode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerFailoverMode.java new file mode 100644 index 000000000000..7412cf7f3bae --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerFailoverMode.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Property to set the failover mode of the availability group replica. + */ +public final class ArcSqlServerFailoverMode extends ExpandableStringEnum { + /** + * Static value AUTOMATIC for ArcSqlServerFailoverMode. + */ + public static final ArcSqlServerFailoverMode AUTOMATIC = fromString("AUTOMATIC"); + + /** + * Static value MANUAL for ArcSqlServerFailoverMode. + */ + public static final ArcSqlServerFailoverMode MANUAL = fromString("MANUAL"); + + /** + * Static value EXTERNAL for ArcSqlServerFailoverMode. + */ + public static final ArcSqlServerFailoverMode EXTERNAL = fromString("EXTERNAL"); + + /** + * Creates a new instance of ArcSqlServerFailoverMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ArcSqlServerFailoverMode() { + } + + /** + * Creates or finds a ArcSqlServerFailoverMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ArcSqlServerFailoverMode. + */ + public static ArcSqlServerFailoverMode fromString(String name) { + return fromString(name, ArcSqlServerFailoverMode.class); + } + + /** + * Gets known ArcSqlServerFailoverMode values. + * + * @return known ArcSqlServerFailoverMode values. + */ + public static Collection values() { + return values(ArcSqlServerFailoverMode.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerLicenseType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerLicenseType.java index 5141df1cb919..a7bbc700dc85 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerLicenseType.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerLicenseType.java @@ -5,26 +5,50 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** SQL Server license type. */ +/** + * SQL Server license type. + */ public final class ArcSqlServerLicenseType extends ExpandableStringEnum { - /** Static value Paid for ArcSqlServerLicenseType. */ - public static final ArcSqlServerLicenseType PAID = fromString("Paid"); + /** + * Static value Undefined for ArcSqlServerLicenseType. + */ + public static final ArcSqlServerLicenseType UNDEFINED = fromString("Undefined"); - /** Static value Free for ArcSqlServerLicenseType. */ + /** + * Static value Free for ArcSqlServerLicenseType. + */ public static final ArcSqlServerLicenseType FREE = fromString("Free"); - /** Static value HADR for ArcSqlServerLicenseType. */ + /** + * Static value HADR for ArcSqlServerLicenseType. + */ public static final ArcSqlServerLicenseType HADR = fromString("HADR"); - /** Static value Undefined for ArcSqlServerLicenseType. */ - public static final ArcSqlServerLicenseType UNDEFINED = fromString("Undefined"); + /** + * Static value ServerCAL for ArcSqlServerLicenseType. + */ + public static final ArcSqlServerLicenseType SERVER_CAL = fromString("ServerCAL"); + + /** + * Static value LicenseOnly for ArcSqlServerLicenseType. + */ + public static final ArcSqlServerLicenseType LICENSE_ONLY = fromString("LicenseOnly"); + + /** + * Static value PAYG for ArcSqlServerLicenseType. + */ + public static final ArcSqlServerLicenseType PAYG = fromString("PAYG"); + + /** + * Static value Paid for ArcSqlServerLicenseType. + */ + public static final ArcSqlServerLicenseType PAID = fromString("Paid"); /** * Creates a new instance of ArcSqlServerLicenseType value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -33,18 +57,17 @@ public ArcSqlServerLicenseType() { /** * Creates or finds a ArcSqlServerLicenseType from its string representation. - * + * * @param name a name to look for. * @return the corresponding ArcSqlServerLicenseType. */ - @JsonCreator public static ArcSqlServerLicenseType fromString(String name) { return fromString(name, ArcSqlServerLicenseType.class); } /** * Gets known ArcSqlServerLicenseType values. - * + * * @return known ArcSqlServerLicenseType values. */ public static Collection values() { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AutomatedBackupPreference.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AutomatedBackupPreference.java new file mode 100644 index 000000000000..5a4b1341c287 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AutomatedBackupPreference.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * Preferred replica for running automated backups. + */ +public enum AutomatedBackupPreference { + /** + * Enum value PRIMARY. + */ + PRIMARY("PRIMARY"), + + /** + * Enum value SECONDARY_ONLY. + */ + SECONDARY_ONLY("SECONDARY_ONLY"), + + /** + * Enum value SECONDARY. + */ + SECONDARY("SECONDARY"), + + /** + * Enum value NONE. + */ + NONE("NONE"); + + /** + * The actual serialized value for a AutomatedBackupPreference instance. + */ + private final String value; + + AutomatedBackupPreference(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomatedBackupPreference instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomatedBackupPreference object, or null if unable to parse. + */ + public static AutomatedBackupPreference fromString(String value) { + if (value == null) { + return null; + } + AutomatedBackupPreference[] items = AutomatedBackupPreference.values(); + for (AutomatedBackupPreference item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupConfigure.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupConfigure.java new file mode 100644 index 000000000000..1ad9961846dd --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupConfigure.java @@ -0,0 +1,611 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * The specifications of the availability group replica configuration. + */ +@Fluent +public final class AvailabilityGroupConfigure implements JsonSerializable { + /* + * Name of the mirroring endpoint URL + */ + private String endpointName; + + /* + * Mirroring endpoint URL of availability group replica + */ + private String endpointUrl; + + /* + * Permitted authentication modes for the mirroring endpoint. + */ + private ConnectionAuth endpointAuthenticationMode; + + /* + * Name of certificate to use for authentication. Required if any CERTIFICATE authentication modes are specified. + */ + private String certificateName; + + /* + * The login which will connect to the mirroring endpoint. + */ + private String endpointConnectLogin; + + /* + * Property that determines whether a given availability replica can run in synchronous-commit mode + */ + private ArcSqlServerAvailabilityMode availabilityMode; + + /* + * The Availability Synchronization mode of the availability group replica. + */ + private String availabilityModeDescription; + + /* + * Property to set the failover mode of the availability group replica + */ + private ArcSqlServerFailoverMode failoverMode; + + /* + * The failover mode of the availability group replica. + */ + private String failoverModeDescription; + + /* + * The time-out period of availability group session replica, in seconds. + */ + private Integer sessionTimeout; + + /* + * Whether the primary replica should allow all connections or only READ_WRITE connections (disallowing ReadOnly + * connections) + */ + private PrimaryAllowConnections primaryAllowConnections; + + /* + * Whether the availability allows all connections or only read-write connections. + */ + private String primaryRoleAllowConnectionsDescription; + + /* + * Whether the secondary replica should allow all connections, no connections, or only ReadOnly connections. + */ + private SecondaryAllowConnections secondaryAllowConnections; + + /* + * Whether an availability replica that is performing the secondary role (that is, a secondary replica) can accept + * connections from clients. + */ + private String secondaryRoleAllowConnectionsDescription; + + /* + * Date that the replica was created. + */ + private OffsetDateTime replicaCreateDate; + + /* + * Date that the replica was modified. + */ + private OffsetDateTime replicaModifyDate; + + /* + * Represents the user-specified priority for performing backups on this replica relative to the other replicas in + * the same availability group. + */ + private Integer backupPriority; + + /* + * Connectivity endpoint (URL) of the read only availability replica. + */ + private String readOnlyRoutingUrl; + + /* + * Connectivity endpoint (URL) of the read write availability replica. + */ + private String readWriteRoutingUrl; + + /* + * Specifies how the secondary replica will be initially seeded. AUTOMATIC enables direct seeding. This method will + * seed the secondary replica over the network. This method does not require you to backup and restore a copy of the + * primary database on the replica. MANUAL specifies manual seeding (default). This method requires you to create a + * backup of the database on the primary replica and manually restore that backup on the secondary replica. + */ + private SeedingMode seedingMode; + + /* + * Describes seeding mode. + */ + private String seedingModeDescription; + + /** + * Creates an instance of AvailabilityGroupConfigure class. + */ + public AvailabilityGroupConfigure() { + } + + /** + * Get the endpointName property: Name of the mirroring endpoint URL. + * + * @return the endpointName value. + */ + public String endpointName() { + return this.endpointName; + } + + /** + * Set the endpointName property: Name of the mirroring endpoint URL. + * + * @param endpointName the endpointName value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withEndpointName(String endpointName) { + this.endpointName = endpointName; + return this; + } + + /** + * Get the endpointUrl property: Mirroring endpoint URL of availability group replica. + * + * @return the endpointUrl value. + */ + public String endpointUrl() { + return this.endpointUrl; + } + + /** + * Set the endpointUrl property: Mirroring endpoint URL of availability group replica. + * + * @param endpointUrl the endpointUrl value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withEndpointUrl(String endpointUrl) { + this.endpointUrl = endpointUrl; + return this; + } + + /** + * Get the endpointAuthenticationMode property: Permitted authentication modes for the mirroring endpoint. + * + * @return the endpointAuthenticationMode value. + */ + public ConnectionAuth endpointAuthenticationMode() { + return this.endpointAuthenticationMode; + } + + /** + * Set the endpointAuthenticationMode property: Permitted authentication modes for the mirroring endpoint. + * + * @param endpointAuthenticationMode the endpointAuthenticationMode value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withEndpointAuthenticationMode(ConnectionAuth endpointAuthenticationMode) { + this.endpointAuthenticationMode = endpointAuthenticationMode; + return this; + } + + /** + * Get the certificateName property: Name of certificate to use for authentication. Required if any CERTIFICATE + * authentication modes are specified. + * + * @return the certificateName value. + */ + public String certificateName() { + return this.certificateName; + } + + /** + * Set the certificateName property: Name of certificate to use for authentication. Required if any CERTIFICATE + * authentication modes are specified. + * + * @param certificateName the certificateName value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withCertificateName(String certificateName) { + this.certificateName = certificateName; + return this; + } + + /** + * Get the endpointConnectLogin property: The login which will connect to the mirroring endpoint. + * + * @return the endpointConnectLogin value. + */ + public String endpointConnectLogin() { + return this.endpointConnectLogin; + } + + /** + * Set the endpointConnectLogin property: The login which will connect to the mirroring endpoint. + * + * @param endpointConnectLogin the endpointConnectLogin value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withEndpointConnectLogin(String endpointConnectLogin) { + this.endpointConnectLogin = endpointConnectLogin; + return this; + } + + /** + * Get the availabilityMode property: Property that determines whether a given availability replica can run in + * synchronous-commit mode. + * + * @return the availabilityMode value. + */ + public ArcSqlServerAvailabilityMode availabilityMode() { + return this.availabilityMode; + } + + /** + * Set the availabilityMode property: Property that determines whether a given availability replica can run in + * synchronous-commit mode. + * + * @param availabilityMode the availabilityMode value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withAvailabilityMode(ArcSqlServerAvailabilityMode availabilityMode) { + this.availabilityMode = availabilityMode; + return this; + } + + /** + * Get the availabilityModeDescription property: The Availability Synchronization mode of the availability group + * replica. + * + * @return the availabilityModeDescription value. + */ + public String availabilityModeDescription() { + return this.availabilityModeDescription; + } + + /** + * Get the failoverMode property: Property to set the failover mode of the availability group replica. + * + * @return the failoverMode value. + */ + public ArcSqlServerFailoverMode failoverMode() { + return this.failoverMode; + } + + /** + * Set the failoverMode property: Property to set the failover mode of the availability group replica. + * + * @param failoverMode the failoverMode value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withFailoverMode(ArcSqlServerFailoverMode failoverMode) { + this.failoverMode = failoverMode; + return this; + } + + /** + * Get the failoverModeDescription property: The failover mode of the availability group replica. + * + * @return the failoverModeDescription value. + */ + public String failoverModeDescription() { + return this.failoverModeDescription; + } + + /** + * Get the sessionTimeout property: The time-out period of availability group session replica, in seconds. + * + * @return the sessionTimeout value. + */ + public Integer sessionTimeout() { + return this.sessionTimeout; + } + + /** + * Set the sessionTimeout property: The time-out period of availability group session replica, in seconds. + * + * @param sessionTimeout the sessionTimeout value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withSessionTimeout(Integer sessionTimeout) { + this.sessionTimeout = sessionTimeout; + return this; + } + + /** + * Get the primaryAllowConnections property: Whether the primary replica should allow all connections or only + * READ_WRITE connections (disallowing ReadOnly connections). + * + * @return the primaryAllowConnections value. + */ + public PrimaryAllowConnections primaryAllowConnections() { + return this.primaryAllowConnections; + } + + /** + * Set the primaryAllowConnections property: Whether the primary replica should allow all connections or only + * READ_WRITE connections (disallowing ReadOnly connections). + * + * @param primaryAllowConnections the primaryAllowConnections value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withPrimaryAllowConnections(PrimaryAllowConnections primaryAllowConnections) { + this.primaryAllowConnections = primaryAllowConnections; + return this; + } + + /** + * Get the primaryRoleAllowConnectionsDescription property: Whether the availability allows all connections or only + * read-write connections. + * + * @return the primaryRoleAllowConnectionsDescription value. + */ + public String primaryRoleAllowConnectionsDescription() { + return this.primaryRoleAllowConnectionsDescription; + } + + /** + * Get the secondaryAllowConnections property: Whether the secondary replica should allow all connections, no + * connections, or only ReadOnly connections. + * + * @return the secondaryAllowConnections value. + */ + public SecondaryAllowConnections secondaryAllowConnections() { + return this.secondaryAllowConnections; + } + + /** + * Set the secondaryAllowConnections property: Whether the secondary replica should allow all connections, no + * connections, or only ReadOnly connections. + * + * @param secondaryAllowConnections the secondaryAllowConnections value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure + withSecondaryAllowConnections(SecondaryAllowConnections secondaryAllowConnections) { + this.secondaryAllowConnections = secondaryAllowConnections; + return this; + } + + /** + * Get the secondaryRoleAllowConnectionsDescription property: Whether an availability replica that is performing the + * secondary role (that is, a secondary replica) can accept connections from clients. + * + * @return the secondaryRoleAllowConnectionsDescription value. + */ + public String secondaryRoleAllowConnectionsDescription() { + return this.secondaryRoleAllowConnectionsDescription; + } + + /** + * Get the replicaCreateDate property: Date that the replica was created. + * + * @return the replicaCreateDate value. + */ + public OffsetDateTime replicaCreateDate() { + return this.replicaCreateDate; + } + + /** + * Get the replicaModifyDate property: Date that the replica was modified. + * + * @return the replicaModifyDate value. + */ + public OffsetDateTime replicaModifyDate() { + return this.replicaModifyDate; + } + + /** + * Get the backupPriority property: Represents the user-specified priority for performing backups on this replica + * relative to the other replicas in the same availability group. + * + * @return the backupPriority value. + */ + public Integer backupPriority() { + return this.backupPriority; + } + + /** + * Set the backupPriority property: Represents the user-specified priority for performing backups on this replica + * relative to the other replicas in the same availability group. + * + * @param backupPriority the backupPriority value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withBackupPriority(Integer backupPriority) { + this.backupPriority = backupPriority; + return this; + } + + /** + * Get the readOnlyRoutingUrl property: Connectivity endpoint (URL) of the read only availability replica. + * + * @return the readOnlyRoutingUrl value. + */ + public String readOnlyRoutingUrl() { + return this.readOnlyRoutingUrl; + } + + /** + * Set the readOnlyRoutingUrl property: Connectivity endpoint (URL) of the read only availability replica. + * + * @param readOnlyRoutingUrl the readOnlyRoutingUrl value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withReadOnlyRoutingUrl(String readOnlyRoutingUrl) { + this.readOnlyRoutingUrl = readOnlyRoutingUrl; + return this; + } + + /** + * Get the readWriteRoutingUrl property: Connectivity endpoint (URL) of the read write availability replica. + * + * @return the readWriteRoutingUrl value. + */ + public String readWriteRoutingUrl() { + return this.readWriteRoutingUrl; + } + + /** + * Set the readWriteRoutingUrl property: Connectivity endpoint (URL) of the read write availability replica. + * + * @param readWriteRoutingUrl the readWriteRoutingUrl value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withReadWriteRoutingUrl(String readWriteRoutingUrl) { + this.readWriteRoutingUrl = readWriteRoutingUrl; + return this; + } + + /** + * Get the seedingMode property: Specifies how the secondary replica will be initially seeded. AUTOMATIC enables + * direct seeding. This method will seed the secondary replica over the network. This method does not require you to + * backup and restore a copy of the primary database on the replica. MANUAL specifies manual seeding (default). This + * method requires you to create a backup of the database on the primary replica and manually restore that backup on + * the secondary replica. + * + * @return the seedingMode value. + */ + public SeedingMode seedingMode() { + return this.seedingMode; + } + + /** + * Set the seedingMode property: Specifies how the secondary replica will be initially seeded. AUTOMATIC enables + * direct seeding. This method will seed the secondary replica over the network. This method does not require you to + * backup and restore a copy of the primary database on the replica. MANUAL specifies manual seeding (default). This + * method requires you to create a backup of the database on the primary replica and manually restore that backup on + * the secondary replica. + * + * @param seedingMode the seedingMode value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withSeedingMode(SeedingMode seedingMode) { + this.seedingMode = seedingMode; + return this; + } + + /** + * Get the seedingModeDescription property: Describes seeding mode. + * + * @return the seedingModeDescription value. + */ + public String seedingModeDescription() { + return this.seedingModeDescription; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("endpointName", this.endpointName); + jsonWriter.writeStringField("endpointUrl", this.endpointUrl); + jsonWriter.writeStringField("endpointAuthenticationMode", + this.endpointAuthenticationMode == null ? null : this.endpointAuthenticationMode.toString()); + jsonWriter.writeStringField("certificateName", this.certificateName); + jsonWriter.writeStringField("endpointConnectLogin", this.endpointConnectLogin); + jsonWriter.writeStringField("availabilityMode", + this.availabilityMode == null ? null : this.availabilityMode.toString()); + jsonWriter.writeStringField("failoverMode", this.failoverMode == null ? null : this.failoverMode.toString()); + jsonWriter.writeNumberField("sessionTimeout", this.sessionTimeout); + jsonWriter.writeStringField("primaryAllowConnections", + this.primaryAllowConnections == null ? null : this.primaryAllowConnections.toString()); + jsonWriter.writeStringField("secondaryAllowConnections", + this.secondaryAllowConnections == null ? null : this.secondaryAllowConnections.toString()); + jsonWriter.writeNumberField("backupPriority", this.backupPriority); + jsonWriter.writeStringField("readOnlyRoutingUrl", this.readOnlyRoutingUrl); + jsonWriter.writeStringField("readWriteRoutingUrl", this.readWriteRoutingUrl); + jsonWriter.writeStringField("seedingMode", this.seedingMode == null ? null : this.seedingMode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AvailabilityGroupConfigure from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AvailabilityGroupConfigure if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AvailabilityGroupConfigure. + */ + public static AvailabilityGroupConfigure fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AvailabilityGroupConfigure deserializedAvailabilityGroupConfigure = new AvailabilityGroupConfigure(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("endpointName".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.endpointName = reader.getString(); + } else if ("endpointUrl".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.endpointUrl = reader.getString(); + } else if ("endpointAuthenticationMode".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.endpointAuthenticationMode + = ConnectionAuth.fromString(reader.getString()); + } else if ("certificateName".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.certificateName = reader.getString(); + } else if ("endpointConnectLogin".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.endpointConnectLogin = reader.getString(); + } else if ("availabilityMode".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.availabilityMode + = ArcSqlServerAvailabilityMode.fromString(reader.getString()); + } else if ("availabilityModeDescription".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.availabilityModeDescription = reader.getString(); + } else if ("failoverMode".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.failoverMode + = ArcSqlServerFailoverMode.fromString(reader.getString()); + } else if ("failoverModeDescription".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.failoverModeDescription = reader.getString(); + } else if ("sessionTimeout".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.sessionTimeout = reader.getNullable(JsonReader::getInt); + } else if ("primaryAllowConnections".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.primaryAllowConnections + = PrimaryAllowConnections.fromString(reader.getString()); + } else if ("primaryRoleAllowConnectionsDescription".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.primaryRoleAllowConnectionsDescription = reader.getString(); + } else if ("secondaryAllowConnections".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.secondaryAllowConnections + = SecondaryAllowConnections.fromString(reader.getString()); + } else if ("secondaryRoleAllowConnectionsDescription".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.secondaryRoleAllowConnectionsDescription + = reader.getString(); + } else if ("replicaCreateDate".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.replicaCreateDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("replicaModifyDate".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.replicaModifyDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("backupPriority".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.backupPriority = reader.getNullable(JsonReader::getInt); + } else if ("readOnlyRoutingUrl".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.readOnlyRoutingUrl = reader.getString(); + } else if ("readWriteRoutingUrl".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.readWriteRoutingUrl = reader.getString(); + } else if ("seedingMode".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.seedingMode = SeedingMode.fromString(reader.getString()); + } else if ("seedingModeDescription".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.seedingModeDescription = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAvailabilityGroupConfigure; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupCreateUpdateConfiguration.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupCreateUpdateConfiguration.java new file mode 100644 index 000000000000..c82b076ad924 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupCreateUpdateConfiguration.java @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Options used in creating an availability group. + */ +@Fluent +public final class AvailabilityGroupCreateUpdateConfiguration + implements JsonSerializable { + /* + * Name of the availability group. + */ + private String availabilityGroupName; + + /* + * List of availability group replicas. + */ + private List replicas; + + /* + * List of databases to include in the availability group. + */ + private List databases; + + /* + * Preferred replica for running automated backups. + */ + private AutomatedBackupPreference automatedBackupPreference; + + /* + * User-defined failure condition level under which an automatic failover must be triggered. + */ + private FailureConditionLevel failureConditionLevel; + + /* + * Wait time (in milliseconds) for the sp_server_diagnostics system stored procedure to return server-health + * information, before the server instance is assumed to be slow or not responding. + */ + private Integer healthCheckTimeout; + + /* + * Specifies whether the availability group supports failover for database health conditions. + */ + private DbFailover dbFailover; + + /* + * Specifies whether DTC support has been enabled for this availability group. + */ + private DtcSupport dtcSupport; + + /* + * The number of secondary replicas that must be in a synchronized state for a commit to complete. + */ + private Integer requiredSynchronizedSecondariesToCommit; + + /* + * Set to WSFC when availability group is on a failover cluster instance on a Windows Server failover cluster. Set + * to NONE when availability group not using WSFC for cluster coordination. + */ + private ClusterType clusterType; + + /* + * The listener for the sql server availability group + */ + private SqlAvailabilityGroupStaticIpListenerProperties listener; + + /** + * Creates an instance of AvailabilityGroupCreateUpdateConfiguration class. + */ + public AvailabilityGroupCreateUpdateConfiguration() { + } + + /** + * Get the availabilityGroupName property: Name of the availability group. + * + * @return the availabilityGroupName value. + */ + public String availabilityGroupName() { + return this.availabilityGroupName; + } + + /** + * Set the availabilityGroupName property: Name of the availability group. + * + * @param availabilityGroupName the availabilityGroupName value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration withAvailabilityGroupName(String availabilityGroupName) { + this.availabilityGroupName = availabilityGroupName; + return this; + } + + /** + * Get the replicas property: List of availability group replicas. + * + * @return the replicas value. + */ + public List replicas() { + return this.replicas; + } + + /** + * Set the replicas property: List of availability group replicas. + * + * @param replicas the replicas value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration + withReplicas(List replicas) { + this.replicas = replicas; + return this; + } + + /** + * Get the databases property: List of databases to include in the availability group. + * + * @return the databases value. + */ + public List databases() { + return this.databases; + } + + /** + * Set the databases property: List of databases to include in the availability group. + * + * @param databases the databases value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration withDatabases(List databases) { + this.databases = databases; + return this; + } + + /** + * Get the automatedBackupPreference property: Preferred replica for running automated backups. + * + * @return the automatedBackupPreference value. + */ + public AutomatedBackupPreference automatedBackupPreference() { + return this.automatedBackupPreference; + } + + /** + * Set the automatedBackupPreference property: Preferred replica for running automated backups. + * + * @param automatedBackupPreference the automatedBackupPreference value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration + withAutomatedBackupPreference(AutomatedBackupPreference automatedBackupPreference) { + this.automatedBackupPreference = automatedBackupPreference; + return this; + } + + /** + * Get the failureConditionLevel property: User-defined failure condition level under which an automatic failover + * must be triggered. + * + * @return the failureConditionLevel value. + */ + public FailureConditionLevel failureConditionLevel() { + return this.failureConditionLevel; + } + + /** + * Set the failureConditionLevel property: User-defined failure condition level under which an automatic failover + * must be triggered. + * + * @param failureConditionLevel the failureConditionLevel value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration + withFailureConditionLevel(FailureConditionLevel failureConditionLevel) { + this.failureConditionLevel = failureConditionLevel; + return this; + } + + /** + * Get the healthCheckTimeout property: Wait time (in milliseconds) for the sp_server_diagnostics system stored + * procedure to return server-health information, before the server instance is assumed to be slow or not + * responding. + * + * @return the healthCheckTimeout value. + */ + public Integer healthCheckTimeout() { + return this.healthCheckTimeout; + } + + /** + * Set the healthCheckTimeout property: Wait time (in milliseconds) for the sp_server_diagnostics system stored + * procedure to return server-health information, before the server instance is assumed to be slow or not + * responding. + * + * @param healthCheckTimeout the healthCheckTimeout value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration withHealthCheckTimeout(Integer healthCheckTimeout) { + this.healthCheckTimeout = healthCheckTimeout; + return this; + } + + /** + * Get the dbFailover property: Specifies whether the availability group supports failover for database health + * conditions. + * + * @return the dbFailover value. + */ + public DbFailover dbFailover() { + return this.dbFailover; + } + + /** + * Set the dbFailover property: Specifies whether the availability group supports failover for database health + * conditions. + * + * @param dbFailover the dbFailover value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration withDbFailover(DbFailover dbFailover) { + this.dbFailover = dbFailover; + return this; + } + + /** + * Get the dtcSupport property: Specifies whether DTC support has been enabled for this availability group. + * + * @return the dtcSupport value. + */ + public DtcSupport dtcSupport() { + return this.dtcSupport; + } + + /** + * Set the dtcSupport property: Specifies whether DTC support has been enabled for this availability group. + * + * @param dtcSupport the dtcSupport value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration withDtcSupport(DtcSupport dtcSupport) { + this.dtcSupport = dtcSupport; + return this; + } + + /** + * Get the requiredSynchronizedSecondariesToCommit property: The number of secondary replicas that must be in a + * synchronized state for a commit to complete. + * + * @return the requiredSynchronizedSecondariesToCommit value. + */ + public Integer requiredSynchronizedSecondariesToCommit() { + return this.requiredSynchronizedSecondariesToCommit; + } + + /** + * Set the requiredSynchronizedSecondariesToCommit property: The number of secondary replicas that must be in a + * synchronized state for a commit to complete. + * + * @param requiredSynchronizedSecondariesToCommit the requiredSynchronizedSecondariesToCommit value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration + withRequiredSynchronizedSecondariesToCommit(Integer requiredSynchronizedSecondariesToCommit) { + this.requiredSynchronizedSecondariesToCommit = requiredSynchronizedSecondariesToCommit; + return this; + } + + /** + * Get the clusterType property: Set to WSFC when availability group is on a failover cluster instance on a Windows + * Server failover cluster. Set to NONE when availability group not using WSFC for cluster coordination. + * + * @return the clusterType value. + */ + public ClusterType clusterType() { + return this.clusterType; + } + + /** + * Set the clusterType property: Set to WSFC when availability group is on a failover cluster instance on a Windows + * Server failover cluster. Set to NONE when availability group not using WSFC for cluster coordination. + * + * @param clusterType the clusterType value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration withClusterType(ClusterType clusterType) { + this.clusterType = clusterType; + return this; + } + + /** + * Get the listener property: The listener for the sql server availability group. + * + * @return the listener value. + */ + public SqlAvailabilityGroupStaticIpListenerProperties listener() { + return this.listener; + } + + /** + * Set the listener property: The listener for the sql server availability group. + * + * @param listener the listener value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration + withListener(SqlAvailabilityGroupStaticIpListenerProperties listener) { + this.listener = listener; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (replicas() != null) { + replicas().forEach(e -> e.validate()); + } + if (listener() != null) { + listener().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("availabilityGroupName", this.availabilityGroupName); + jsonWriter.writeArrayField("replicas", this.replicas, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("databases", this.databases, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("automatedBackupPreference", + this.automatedBackupPreference == null ? null : this.automatedBackupPreference.toString()); + jsonWriter.writeNumberField("failureConditionLevel", + this.failureConditionLevel == null ? null : this.failureConditionLevel.toInt()); + jsonWriter.writeNumberField("healthCheckTimeout", this.healthCheckTimeout); + jsonWriter.writeStringField("dbFailover", this.dbFailover == null ? null : this.dbFailover.toString()); + jsonWriter.writeStringField("dtcSupport", this.dtcSupport == null ? null : this.dtcSupport.toString()); + jsonWriter.writeNumberField("requiredSynchronizedSecondariesToCommit", + this.requiredSynchronizedSecondariesToCommit); + jsonWriter.writeStringField("clusterType", this.clusterType == null ? null : this.clusterType.toString()); + jsonWriter.writeJsonField("listener", this.listener); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AvailabilityGroupCreateUpdateConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AvailabilityGroupCreateUpdateConfiguration if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AvailabilityGroupCreateUpdateConfiguration. + */ + public static AvailabilityGroupCreateUpdateConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AvailabilityGroupCreateUpdateConfiguration deserializedAvailabilityGroupCreateUpdateConfiguration + = new AvailabilityGroupCreateUpdateConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("availabilityGroupName".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.availabilityGroupName = reader.getString(); + } else if ("replicas".equals(fieldName)) { + List replicas = reader + .readArray(reader1 -> AvailabilityGroupCreateUpdateReplicaConfiguration.fromJson(reader1)); + deserializedAvailabilityGroupCreateUpdateConfiguration.replicas = replicas; + } else if ("databases".equals(fieldName)) { + List databases = reader.readArray(reader1 -> reader1.getString()); + deserializedAvailabilityGroupCreateUpdateConfiguration.databases = databases; + } else if ("automatedBackupPreference".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.automatedBackupPreference + = AutomatedBackupPreference.fromString(reader.getString()); + } else if ("failureConditionLevel".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.failureConditionLevel + = FailureConditionLevel.fromInt(reader.getInt()); + } else if ("healthCheckTimeout".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.healthCheckTimeout + = reader.getNullable(JsonReader::getInt); + } else if ("dbFailover".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.dbFailover + = DbFailover.fromString(reader.getString()); + } else if ("dtcSupport".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.dtcSupport + = DtcSupport.fromString(reader.getString()); + } else if ("requiredSynchronizedSecondariesToCommit".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.requiredSynchronizedSecondariesToCommit + = reader.getNullable(JsonReader::getInt); + } else if ("clusterType".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.clusterType + = ClusterType.fromString(reader.getString()); + } else if ("listener".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.listener + = SqlAvailabilityGroupStaticIpListenerProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAvailabilityGroupCreateUpdateConfiguration; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupCreateUpdateReplicaConfiguration.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupCreateUpdateReplicaConfiguration.java new file mode 100644 index 000000000000..1d6bdc68ea58 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupCreateUpdateReplicaConfiguration.java @@ -0,0 +1,536 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The specifications of the availability group replica configuration. + */ +@Fluent +public final class AvailabilityGroupCreateUpdateReplicaConfiguration + implements JsonSerializable { + /* + * the server instance hosting the replica. + */ + private String serverInstance; + + /* + * Name of the database mirroring endpoint URL for the availability group replica + */ + private String endpointName; + + /* + * Database mirroring endpoint URL of availability group replica + */ + private String endpointUrl; + + /* + * Permitted authentication modes for the mirroring endpoint. + */ + private ConnectionAuth endpointAuthenticationMode; + + /* + * Name of certificate to use for authentication. Required if any CERTIFICATE authentication modes are specified. + */ + private String certificateName; + + /* + * The login which will connect to the mirroring endpoint + */ + private String endpointConnectLogin; + + /* + * Property that determines whether a given availability replica can run in synchronous-commit mode + */ + private ArcSqlServerAvailabilityMode availabilityMode; + + /* + * Property to set the failover mode of the availability group replica + */ + private ArcSqlServerFailoverMode failoverMode; + + /* + * Specifies how the secondary replica will be initially seeded. AUTOMATIC enables direct seeding. This method will + * seed the secondary replica over the network. This method does not require you to backup and restore a copy of the + * primary database on the replica. MANUAL specifies manual seeding (default). This method requires you to create a + * backup of the database on the primary replica and manually restore that backup on the secondary replica. + */ + private SeedingMode seedingMode; + + /* + * Represents the user-specified priority for performing backups on this replica relative to the other replicas in + * the same availability group. + */ + private Integer backupPriority; + + /* + * Whether the secondary replica should allow all connections, no connections, or only ReadOnly connections. + */ + private SecondaryAllowConnections secondaryRoleAllowConnections; + + /* + * Connectivity endpoint (URL) of the read only availability replica. + */ + private String secondaryRoleReadOnlyRoutingUrl; + + /* + * Whether the primary replica should allow all connections or only READ_WRITE connections (disallowing ReadOnly + * connections) + */ + private PrimaryAllowConnections primaryRoleAllowConnections; + + /* + * List of read only routing URLs. + */ + private List primaryRoleReadOnlyRoutingList; + + /* + * The time-out period of availability group session replica, in seconds. + */ + private Integer sessionTimeout; + + /** + * Creates an instance of AvailabilityGroupCreateUpdateReplicaConfiguration class. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration() { + } + + /** + * Get the serverInstance property: the server instance hosting the replica. + * + * @return the serverInstance value. + */ + public String serverInstance() { + return this.serverInstance; + } + + /** + * Set the serverInstance property: the server instance hosting the replica. + * + * @param serverInstance the serverInstance value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withServerInstance(String serverInstance) { + this.serverInstance = serverInstance; + return this; + } + + /** + * Get the endpointName property: Name of the database mirroring endpoint URL for the availability group replica. + * + * @return the endpointName value. + */ + public String endpointName() { + return this.endpointName; + } + + /** + * Set the endpointName property: Name of the database mirroring endpoint URL for the availability group replica. + * + * @param endpointName the endpointName value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withEndpointName(String endpointName) { + this.endpointName = endpointName; + return this; + } + + /** + * Get the endpointUrl property: Database mirroring endpoint URL of availability group replica. + * + * @return the endpointUrl value. + */ + public String endpointUrl() { + return this.endpointUrl; + } + + /** + * Set the endpointUrl property: Database mirroring endpoint URL of availability group replica. + * + * @param endpointUrl the endpointUrl value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withEndpointUrl(String endpointUrl) { + this.endpointUrl = endpointUrl; + return this; + } + + /** + * Get the endpointAuthenticationMode property: Permitted authentication modes for the mirroring endpoint. + * + * @return the endpointAuthenticationMode value. + */ + public ConnectionAuth endpointAuthenticationMode() { + return this.endpointAuthenticationMode; + } + + /** + * Set the endpointAuthenticationMode property: Permitted authentication modes for the mirroring endpoint. + * + * @param endpointAuthenticationMode the endpointAuthenticationMode value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration + withEndpointAuthenticationMode(ConnectionAuth endpointAuthenticationMode) { + this.endpointAuthenticationMode = endpointAuthenticationMode; + return this; + } + + /** + * Get the certificateName property: Name of certificate to use for authentication. Required if any CERTIFICATE + * authentication modes are specified. + * + * @return the certificateName value. + */ + public String certificateName() { + return this.certificateName; + } + + /** + * Set the certificateName property: Name of certificate to use for authentication. Required if any CERTIFICATE + * authentication modes are specified. + * + * @param certificateName the certificateName value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withCertificateName(String certificateName) { + this.certificateName = certificateName; + return this; + } + + /** + * Get the endpointConnectLogin property: The login which will connect to the mirroring endpoint. + * + * @return the endpointConnectLogin value. + */ + public String endpointConnectLogin() { + return this.endpointConnectLogin; + } + + /** + * Set the endpointConnectLogin property: The login which will connect to the mirroring endpoint. + * + * @param endpointConnectLogin the endpointConnectLogin value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withEndpointConnectLogin(String endpointConnectLogin) { + this.endpointConnectLogin = endpointConnectLogin; + return this; + } + + /** + * Get the availabilityMode property: Property that determines whether a given availability replica can run in + * synchronous-commit mode. + * + * @return the availabilityMode value. + */ + public ArcSqlServerAvailabilityMode availabilityMode() { + return this.availabilityMode; + } + + /** + * Set the availabilityMode property: Property that determines whether a given availability replica can run in + * synchronous-commit mode. + * + * @param availabilityMode the availabilityMode value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration + withAvailabilityMode(ArcSqlServerAvailabilityMode availabilityMode) { + this.availabilityMode = availabilityMode; + return this; + } + + /** + * Get the failoverMode property: Property to set the failover mode of the availability group replica. + * + * @return the failoverMode value. + */ + public ArcSqlServerFailoverMode failoverMode() { + return this.failoverMode; + } + + /** + * Set the failoverMode property: Property to set the failover mode of the availability group replica. + * + * @param failoverMode the failoverMode value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withFailoverMode(ArcSqlServerFailoverMode failoverMode) { + this.failoverMode = failoverMode; + return this; + } + + /** + * Get the seedingMode property: Specifies how the secondary replica will be initially seeded. AUTOMATIC enables + * direct seeding. This method will seed the secondary replica over the network. This method does not require you to + * backup and restore a copy of the primary database on the replica. MANUAL specifies manual seeding (default). This + * method requires you to create a backup of the database on the primary replica and manually restore that backup on + * the secondary replica. + * + * @return the seedingMode value. + */ + public SeedingMode seedingMode() { + return this.seedingMode; + } + + /** + * Set the seedingMode property: Specifies how the secondary replica will be initially seeded. AUTOMATIC enables + * direct seeding. This method will seed the secondary replica over the network. This method does not require you to + * backup and restore a copy of the primary database on the replica. MANUAL specifies manual seeding (default). This + * method requires you to create a backup of the database on the primary replica and manually restore that backup on + * the secondary replica. + * + * @param seedingMode the seedingMode value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withSeedingMode(SeedingMode seedingMode) { + this.seedingMode = seedingMode; + return this; + } + + /** + * Get the backupPriority property: Represents the user-specified priority for performing backups on this replica + * relative to the other replicas in the same availability group. + * + * @return the backupPriority value. + */ + public Integer backupPriority() { + return this.backupPriority; + } + + /** + * Set the backupPriority property: Represents the user-specified priority for performing backups on this replica + * relative to the other replicas in the same availability group. + * + * @param backupPriority the backupPriority value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withBackupPriority(Integer backupPriority) { + this.backupPriority = backupPriority; + return this; + } + + /** + * Get the secondaryRoleAllowConnections property: Whether the secondary replica should allow all connections, no + * connections, or only ReadOnly connections. + * + * @return the secondaryRoleAllowConnections value. + */ + public SecondaryAllowConnections secondaryRoleAllowConnections() { + return this.secondaryRoleAllowConnections; + } + + /** + * Set the secondaryRoleAllowConnections property: Whether the secondary replica should allow all connections, no + * connections, or only ReadOnly connections. + * + * @param secondaryRoleAllowConnections the secondaryRoleAllowConnections value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration + withSecondaryRoleAllowConnections(SecondaryAllowConnections secondaryRoleAllowConnections) { + this.secondaryRoleAllowConnections = secondaryRoleAllowConnections; + return this; + } + + /** + * Get the secondaryRoleReadOnlyRoutingUrl property: Connectivity endpoint (URL) of the read only availability + * replica. + * + * @return the secondaryRoleReadOnlyRoutingUrl value. + */ + public String secondaryRoleReadOnlyRoutingUrl() { + return this.secondaryRoleReadOnlyRoutingUrl; + } + + /** + * Set the secondaryRoleReadOnlyRoutingUrl property: Connectivity endpoint (URL) of the read only availability + * replica. + * + * @param secondaryRoleReadOnlyRoutingUrl the secondaryRoleReadOnlyRoutingUrl value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration + withSecondaryRoleReadOnlyRoutingUrl(String secondaryRoleReadOnlyRoutingUrl) { + this.secondaryRoleReadOnlyRoutingUrl = secondaryRoleReadOnlyRoutingUrl; + return this; + } + + /** + * Get the primaryRoleAllowConnections property: Whether the primary replica should allow all connections or only + * READ_WRITE connections (disallowing ReadOnly connections). + * + * @return the primaryRoleAllowConnections value. + */ + public PrimaryAllowConnections primaryRoleAllowConnections() { + return this.primaryRoleAllowConnections; + } + + /** + * Set the primaryRoleAllowConnections property: Whether the primary replica should allow all connections or only + * READ_WRITE connections (disallowing ReadOnly connections). + * + * @param primaryRoleAllowConnections the primaryRoleAllowConnections value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration + withPrimaryRoleAllowConnections(PrimaryAllowConnections primaryRoleAllowConnections) { + this.primaryRoleAllowConnections = primaryRoleAllowConnections; + return this; + } + + /** + * Get the primaryRoleReadOnlyRoutingList property: List of read only routing URLs. + * + * @return the primaryRoleReadOnlyRoutingList value. + */ + public List primaryRoleReadOnlyRoutingList() { + return this.primaryRoleReadOnlyRoutingList; + } + + /** + * Set the primaryRoleReadOnlyRoutingList property: List of read only routing URLs. + * + * @param primaryRoleReadOnlyRoutingList the primaryRoleReadOnlyRoutingList value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration + withPrimaryRoleReadOnlyRoutingList(List primaryRoleReadOnlyRoutingList) { + this.primaryRoleReadOnlyRoutingList = primaryRoleReadOnlyRoutingList; + return this; + } + + /** + * Get the sessionTimeout property: The time-out period of availability group session replica, in seconds. + * + * @return the sessionTimeout value. + */ + public Integer sessionTimeout() { + return this.sessionTimeout; + } + + /** + * Set the sessionTimeout property: The time-out period of availability group session replica, in seconds. + * + * @param sessionTimeout the sessionTimeout value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withSessionTimeout(Integer sessionTimeout) { + this.sessionTimeout = sessionTimeout; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("serverInstance", this.serverInstance); + jsonWriter.writeStringField("endpointName", this.endpointName); + jsonWriter.writeStringField("endpointUrl", this.endpointUrl); + jsonWriter.writeStringField("endpointAuthenticationMode", + this.endpointAuthenticationMode == null ? null : this.endpointAuthenticationMode.toString()); + jsonWriter.writeStringField("certificateName", this.certificateName); + jsonWriter.writeStringField("endpointConnectLogin", this.endpointConnectLogin); + jsonWriter.writeStringField("availabilityMode", + this.availabilityMode == null ? null : this.availabilityMode.toString()); + jsonWriter.writeStringField("failoverMode", this.failoverMode == null ? null : this.failoverMode.toString()); + jsonWriter.writeStringField("seedingMode", this.seedingMode == null ? null : this.seedingMode.toString()); + jsonWriter.writeNumberField("backupPriority", this.backupPriority); + jsonWriter.writeStringField("secondaryRoleAllowConnections", + this.secondaryRoleAllowConnections == null ? null : this.secondaryRoleAllowConnections.toString()); + jsonWriter.writeStringField("secondaryRoleReadOnlyRoutingUrl", this.secondaryRoleReadOnlyRoutingUrl); + jsonWriter.writeStringField("primaryRoleAllowConnections", + this.primaryRoleAllowConnections == null ? null : this.primaryRoleAllowConnections.toString()); + jsonWriter.writeArrayField("primaryRoleReadOnlyRoutingList", this.primaryRoleReadOnlyRoutingList, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeNumberField("sessionTimeout", this.sessionTimeout); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AvailabilityGroupCreateUpdateReplicaConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AvailabilityGroupCreateUpdateReplicaConfiguration if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AvailabilityGroupCreateUpdateReplicaConfiguration. + */ + public static AvailabilityGroupCreateUpdateReplicaConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AvailabilityGroupCreateUpdateReplicaConfiguration deserializedAvailabilityGroupCreateUpdateReplicaConfiguration + = new AvailabilityGroupCreateUpdateReplicaConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serverInstance".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.serverInstance = reader.getString(); + } else if ("endpointName".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.endpointName = reader.getString(); + } else if ("endpointUrl".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.endpointUrl = reader.getString(); + } else if ("endpointAuthenticationMode".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.endpointAuthenticationMode + = ConnectionAuth.fromString(reader.getString()); + } else if ("certificateName".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.certificateName = reader.getString(); + } else if ("endpointConnectLogin".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.endpointConnectLogin + = reader.getString(); + } else if ("availabilityMode".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.availabilityMode + = ArcSqlServerAvailabilityMode.fromString(reader.getString()); + } else if ("failoverMode".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.failoverMode + = ArcSqlServerFailoverMode.fromString(reader.getString()); + } else if ("seedingMode".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.seedingMode + = SeedingMode.fromString(reader.getString()); + } else if ("backupPriority".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.backupPriority + = reader.getNullable(JsonReader::getInt); + } else if ("secondaryRoleAllowConnections".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.secondaryRoleAllowConnections + = SecondaryAllowConnections.fromString(reader.getString()); + } else if ("secondaryRoleReadOnlyRoutingUrl".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.secondaryRoleReadOnlyRoutingUrl + = reader.getString(); + } else if ("primaryRoleAllowConnections".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.primaryRoleAllowConnections + = PrimaryAllowConnections.fromString(reader.getString()); + } else if ("primaryRoleReadOnlyRoutingList".equals(fieldName)) { + List primaryRoleReadOnlyRoutingList = reader.readArray(reader1 -> reader1.getString()); + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.primaryRoleReadOnlyRoutingList + = primaryRoleReadOnlyRoutingList; + } else if ("sessionTimeout".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.sessionTimeout + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedAvailabilityGroupCreateUpdateReplicaConfiguration; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupInfo.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupInfo.java new file mode 100644 index 000000000000..ed900125fc8b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupInfo.java @@ -0,0 +1,466 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The specifications of the availability group state. + */ +@Fluent +public final class AvailabilityGroupInfo implements JsonSerializable { + /* + * User-defined failure condition level under which an automatic failover must be triggered. + */ + private Integer failureConditionLevel; + + /* + * Wait time (in milliseconds) for the sp_server_diagnostics system stored procedure to return server-health + * information, before the server instance is assumed to be slow or not responding. + */ + private Integer healthCheckTimeout; + + /* + * Preferred location for performing backups on the availability databases in this availability group. + */ + private String automatedBackupPreferenceDescription; + + /* + * SQL Server availability group current version. + */ + private Integer version; + + /* + * Specifies whether this is a basic availability group. + */ + private Boolean basicFeatures; + + /* + * Specifies whether DTC support has been enabled for this availability group. + */ + private Boolean dtcSupport; + + /* + * Specifies whether the availability group supports failover for database health conditions. + */ + private Boolean dbFailover; + + /* + * Specifies whether this is a distributed availability group. + */ + private Boolean isDistributed; + + /* + * SQL Server availability group cluster type description + */ + private String clusterTypeDescription; + + /* + * The number of secondary replicas that must be in a synchronized state for a commit to complete. + */ + private Integer requiredSynchronizedSecondariesToCommit; + + /* + * SQL Server availability group contained system databases. + */ + private Boolean isContained; + + /* + * Name of the server instance that is hosting the current primary replica. + */ + private String primaryReplica; + + /* + * Indicates the recovery health of the primary replica. + */ + private String primaryRecoveryHealthDescription; + + /* + * Indicates the recovery health of a secondary replica. + */ + private String secondaryRecoveryHealthDescription; + + /* + * Reflects a roll-up of the synchronization health of all availability replicas in the availability group. + */ + private String synchronizationHealthDescription; + + /* + * The replicationPartnerType property. + */ + private ReplicationPartnerType replicationPartnerType; + + /* + * The listener for the sql server availability group + */ + private SqlAvailabilityGroupStaticIpListenerProperties listener; + + /** + * Creates an instance of AvailabilityGroupInfo class. + */ + public AvailabilityGroupInfo() { + } + + /** + * Get the failureConditionLevel property: User-defined failure condition level under which an automatic failover + * must be triggered. + * + * @return the failureConditionLevel value. + */ + public Integer failureConditionLevel() { + return this.failureConditionLevel; + } + + /** + * Set the failureConditionLevel property: User-defined failure condition level under which an automatic failover + * must be triggered. + * + * @param failureConditionLevel the failureConditionLevel value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo withFailureConditionLevel(Integer failureConditionLevel) { + this.failureConditionLevel = failureConditionLevel; + return this; + } + + /** + * Get the healthCheckTimeout property: Wait time (in milliseconds) for the sp_server_diagnostics system stored + * procedure to return server-health information, before the server instance is assumed to be slow or not + * responding. + * + * @return the healthCheckTimeout value. + */ + public Integer healthCheckTimeout() { + return this.healthCheckTimeout; + } + + /** + * Set the healthCheckTimeout property: Wait time (in milliseconds) for the sp_server_diagnostics system stored + * procedure to return server-health information, before the server instance is assumed to be slow or not + * responding. + * + * @param healthCheckTimeout the healthCheckTimeout value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo withHealthCheckTimeout(Integer healthCheckTimeout) { + this.healthCheckTimeout = healthCheckTimeout; + return this; + } + + /** + * Get the automatedBackupPreferenceDescription property: Preferred location for performing backups on the + * availability databases in this availability group. + * + * @return the automatedBackupPreferenceDescription value. + */ + public String automatedBackupPreferenceDescription() { + return this.automatedBackupPreferenceDescription; + } + + /** + * Get the version property: SQL Server availability group current version. + * + * @return the version value. + */ + public Integer version() { + return this.version; + } + + /** + * Get the basicFeatures property: Specifies whether this is a basic availability group. + * + * @return the basicFeatures value. + */ + public Boolean basicFeatures() { + return this.basicFeatures; + } + + /** + * Set the basicFeatures property: Specifies whether this is a basic availability group. + * + * @param basicFeatures the basicFeatures value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo withBasicFeatures(Boolean basicFeatures) { + this.basicFeatures = basicFeatures; + return this; + } + + /** + * Get the dtcSupport property: Specifies whether DTC support has been enabled for this availability group. + * + * @return the dtcSupport value. + */ + public Boolean dtcSupport() { + return this.dtcSupport; + } + + /** + * Set the dtcSupport property: Specifies whether DTC support has been enabled for this availability group. + * + * @param dtcSupport the dtcSupport value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo withDtcSupport(Boolean dtcSupport) { + this.dtcSupport = dtcSupport; + return this; + } + + /** + * Get the dbFailover property: Specifies whether the availability group supports failover for database health + * conditions. + * + * @return the dbFailover value. + */ + public Boolean dbFailover() { + return this.dbFailover; + } + + /** + * Set the dbFailover property: Specifies whether the availability group supports failover for database health + * conditions. + * + * @param dbFailover the dbFailover value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo withDbFailover(Boolean dbFailover) { + this.dbFailover = dbFailover; + return this; + } + + /** + * Get the isDistributed property: Specifies whether this is a distributed availability group. + * + * @return the isDistributed value. + */ + public Boolean isDistributed() { + return this.isDistributed; + } + + /** + * Set the isDistributed property: Specifies whether this is a distributed availability group. + * + * @param isDistributed the isDistributed value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo withIsDistributed(Boolean isDistributed) { + this.isDistributed = isDistributed; + return this; + } + + /** + * Get the clusterTypeDescription property: SQL Server availability group cluster type description. + * + * @return the clusterTypeDescription value. + */ + public String clusterTypeDescription() { + return this.clusterTypeDescription; + } + + /** + * Get the requiredSynchronizedSecondariesToCommit property: The number of secondary replicas that must be in a + * synchronized state for a commit to complete. + * + * @return the requiredSynchronizedSecondariesToCommit value. + */ + public Integer requiredSynchronizedSecondariesToCommit() { + return this.requiredSynchronizedSecondariesToCommit; + } + + /** + * Set the requiredSynchronizedSecondariesToCommit property: The number of secondary replicas that must be in a + * synchronized state for a commit to complete. + * + * @param requiredSynchronizedSecondariesToCommit the requiredSynchronizedSecondariesToCommit value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo + withRequiredSynchronizedSecondariesToCommit(Integer requiredSynchronizedSecondariesToCommit) { + this.requiredSynchronizedSecondariesToCommit = requiredSynchronizedSecondariesToCommit; + return this; + } + + /** + * Get the isContained property: SQL Server availability group contained system databases. + * + * @return the isContained value. + */ + public Boolean isContained() { + return this.isContained; + } + + /** + * Set the isContained property: SQL Server availability group contained system databases. + * + * @param isContained the isContained value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo withIsContained(Boolean isContained) { + this.isContained = isContained; + return this; + } + + /** + * Get the primaryReplica property: Name of the server instance that is hosting the current primary replica. + * + * @return the primaryReplica value. + */ + public String primaryReplica() { + return this.primaryReplica; + } + + /** + * Get the primaryRecoveryHealthDescription property: Indicates the recovery health of the primary replica. + * + * @return the primaryRecoveryHealthDescription value. + */ + public String primaryRecoveryHealthDescription() { + return this.primaryRecoveryHealthDescription; + } + + /** + * Get the secondaryRecoveryHealthDescription property: Indicates the recovery health of a secondary replica. + * + * @return the secondaryRecoveryHealthDescription value. + */ + public String secondaryRecoveryHealthDescription() { + return this.secondaryRecoveryHealthDescription; + } + + /** + * Get the synchronizationHealthDescription property: Reflects a roll-up of the synchronization health of all + * availability replicas in the availability group. + * + * @return the synchronizationHealthDescription value. + */ + public String synchronizationHealthDescription() { + return this.synchronizationHealthDescription; + } + + /** + * Get the replicationPartnerType property: The replicationPartnerType property. + * + * @return the replicationPartnerType value. + */ + public ReplicationPartnerType replicationPartnerType() { + return this.replicationPartnerType; + } + + /** + * Get the listener property: The listener for the sql server availability group. + * + * @return the listener value. + */ + public SqlAvailabilityGroupStaticIpListenerProperties listener() { + return this.listener; + } + + /** + * Set the listener property: The listener for the sql server availability group. + * + * @param listener the listener value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo withListener(SqlAvailabilityGroupStaticIpListenerProperties listener) { + this.listener = listener; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (listener() != null) { + listener().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("failureConditionLevel", this.failureConditionLevel); + jsonWriter.writeNumberField("healthCheckTimeout", this.healthCheckTimeout); + jsonWriter.writeBooleanField("basicFeatures", this.basicFeatures); + jsonWriter.writeBooleanField("dtcSupport", this.dtcSupport); + jsonWriter.writeBooleanField("dbFailover", this.dbFailover); + jsonWriter.writeBooleanField("isDistributed", this.isDistributed); + jsonWriter.writeNumberField("requiredSynchronizedSecondariesToCommit", + this.requiredSynchronizedSecondariesToCommit); + jsonWriter.writeBooleanField("isContained", this.isContained); + jsonWriter.writeJsonField("listener", this.listener); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AvailabilityGroupInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AvailabilityGroupInfo if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AvailabilityGroupInfo. + */ + public static AvailabilityGroupInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AvailabilityGroupInfo deserializedAvailabilityGroupInfo = new AvailabilityGroupInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("failureConditionLevel".equals(fieldName)) { + deserializedAvailabilityGroupInfo.failureConditionLevel = reader.getNullable(JsonReader::getInt); + } else if ("healthCheckTimeout".equals(fieldName)) { + deserializedAvailabilityGroupInfo.healthCheckTimeout = reader.getNullable(JsonReader::getInt); + } else if ("automatedBackupPreferenceDescription".equals(fieldName)) { + deserializedAvailabilityGroupInfo.automatedBackupPreferenceDescription = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedAvailabilityGroupInfo.version = reader.getNullable(JsonReader::getInt); + } else if ("basicFeatures".equals(fieldName)) { + deserializedAvailabilityGroupInfo.basicFeatures = reader.getNullable(JsonReader::getBoolean); + } else if ("dtcSupport".equals(fieldName)) { + deserializedAvailabilityGroupInfo.dtcSupport = reader.getNullable(JsonReader::getBoolean); + } else if ("dbFailover".equals(fieldName)) { + deserializedAvailabilityGroupInfo.dbFailover = reader.getNullable(JsonReader::getBoolean); + } else if ("isDistributed".equals(fieldName)) { + deserializedAvailabilityGroupInfo.isDistributed = reader.getNullable(JsonReader::getBoolean); + } else if ("clusterTypeDescription".equals(fieldName)) { + deserializedAvailabilityGroupInfo.clusterTypeDescription = reader.getString(); + } else if ("requiredSynchronizedSecondariesToCommit".equals(fieldName)) { + deserializedAvailabilityGroupInfo.requiredSynchronizedSecondariesToCommit + = reader.getNullable(JsonReader::getInt); + } else if ("isContained".equals(fieldName)) { + deserializedAvailabilityGroupInfo.isContained = reader.getNullable(JsonReader::getBoolean); + } else if ("primaryReplica".equals(fieldName)) { + deserializedAvailabilityGroupInfo.primaryReplica = reader.getString(); + } else if ("primaryRecoveryHealthDescription".equals(fieldName)) { + deserializedAvailabilityGroupInfo.primaryRecoveryHealthDescription = reader.getString(); + } else if ("secondaryRecoveryHealthDescription".equals(fieldName)) { + deserializedAvailabilityGroupInfo.secondaryRecoveryHealthDescription = reader.getString(); + } else if ("synchronizationHealthDescription".equals(fieldName)) { + deserializedAvailabilityGroupInfo.synchronizationHealthDescription = reader.getString(); + } else if ("replicationPartnerType".equals(fieldName)) { + deserializedAvailabilityGroupInfo.replicationPartnerType + = ReplicationPartnerType.fromString(reader.getString()); + } else if ("listener".equals(fieldName)) { + deserializedAvailabilityGroupInfo.listener + = SqlAvailabilityGroupStaticIpListenerProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAvailabilityGroupInfo; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupState.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupState.java new file mode 100644 index 000000000000..0dc9676a9783 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupState.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * The specifications of the availability group state. + */ +@Immutable +public final class AvailabilityGroupState implements JsonSerializable { + /* + * Current Always On availability groups role of the availability group replica. + */ + private String availabilityGroupReplicaRole; + + /* + * Current operational state of the availability group replica + */ + private String operationalStateDescription; + + /* + * Recovery health of the availability group replica. + */ + private String recoveryHealthDescription; + + /* + * Reflects a rollup of the database synchronization state (synchronization_state) of all joined availability + * databases (also known as replicas) and the availability mode of the replica (synchronous-commit or + * asynchronous-commit mode). The rollup will reflect the least healthy accumulated state the databases on the + * replica. + */ + private String synchronizationHealthDescription; + + /* + * Whether a secondary replica is currently connected to the primary replica. + */ + private String connectedStateDescription; + + /* + * Text description of the last connection error of the availability group replica. + */ + private String lastConnectErrorDescription; + + /* + * Date and time timestamp indicating when the last connect error occurred. + */ + private OffsetDateTime lastConnectErrorTimestamp; + + /** + * Creates an instance of AvailabilityGroupState class. + */ + public AvailabilityGroupState() { + } + + /** + * Get the availabilityGroupReplicaRole property: Current Always On availability groups role of the availability + * group replica. + * + * @return the availabilityGroupReplicaRole value. + */ + public String availabilityGroupReplicaRole() { + return this.availabilityGroupReplicaRole; + } + + /** + * Get the operationalStateDescription property: Current operational state of the availability group replica. + * + * @return the operationalStateDescription value. + */ + public String operationalStateDescription() { + return this.operationalStateDescription; + } + + /** + * Get the recoveryHealthDescription property: Recovery health of the availability group replica. + * + * @return the recoveryHealthDescription value. + */ + public String recoveryHealthDescription() { + return this.recoveryHealthDescription; + } + + /** + * Get the synchronizationHealthDescription property: Reflects a rollup of the database synchronization state + * (synchronization_state) of all joined availability databases (also known as replicas) and the availability mode + * of the replica (synchronous-commit or asynchronous-commit mode). The rollup will reflect the least healthy + * accumulated state the databases on the replica. + * + * @return the synchronizationHealthDescription value. + */ + public String synchronizationHealthDescription() { + return this.synchronizationHealthDescription; + } + + /** + * Get the connectedStateDescription property: Whether a secondary replica is currently connected to the primary + * replica. + * + * @return the connectedStateDescription value. + */ + public String connectedStateDescription() { + return this.connectedStateDescription; + } + + /** + * Get the lastConnectErrorDescription property: Text description of the last connection error of the availability + * group replica. + * + * @return the lastConnectErrorDescription value. + */ + public String lastConnectErrorDescription() { + return this.lastConnectErrorDescription; + } + + /** + * Get the lastConnectErrorTimestamp property: Date and time timestamp indicating when the last connect error + * occurred. + * + * @return the lastConnectErrorTimestamp value. + */ + public OffsetDateTime lastConnectErrorTimestamp() { + return this.lastConnectErrorTimestamp; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AvailabilityGroupState from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AvailabilityGroupState if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AvailabilityGroupState. + */ + public static AvailabilityGroupState fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AvailabilityGroupState deserializedAvailabilityGroupState = new AvailabilityGroupState(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("availabilityGroupReplicaRole".equals(fieldName)) { + deserializedAvailabilityGroupState.availabilityGroupReplicaRole = reader.getString(); + } else if ("operationalStateDescription".equals(fieldName)) { + deserializedAvailabilityGroupState.operationalStateDescription = reader.getString(); + } else if ("recoveryHealthDescription".equals(fieldName)) { + deserializedAvailabilityGroupState.recoveryHealthDescription = reader.getString(); + } else if ("synchronizationHealthDescription".equals(fieldName)) { + deserializedAvailabilityGroupState.synchronizationHealthDescription = reader.getString(); + } else if ("connectedStateDescription".equals(fieldName)) { + deserializedAvailabilityGroupState.connectedStateDescription = reader.getString(); + } else if ("lastConnectErrorDescription".equals(fieldName)) { + deserializedAvailabilityGroupState.lastConnectErrorDescription = reader.getString(); + } else if ("lastConnectErrorTimestamp".equals(fieldName)) { + deserializedAvailabilityGroupState.lastConnectErrorTimestamp = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAvailabilityGroupState; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BackgroundJob.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BackgroundJob.java new file mode 100644 index 000000000000..eb41776109b6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BackgroundJob.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The background job details. + */ +@Fluent +public final class BackgroundJob implements JsonSerializable { + /* + * The state of the background job. + */ + private State state; + + /* + * The execution state of the background job. + */ + private ExecutionState executionState; + + /* + * The start time of the background job. + */ + private OffsetDateTime startTime; + + /* + * The end time of the background job. + */ + private OffsetDateTime endTime; + + /* + * The last execution status of the background job. + */ + private LastExecutionStatus lastExecutionStatus; + + /* + * The last execution time of the background job. + */ + private OffsetDateTime lastExecutionTime; + + /** + * Creates an instance of BackgroundJob class. + */ + public BackgroundJob() { + } + + /** + * Get the state property: The state of the background job. + * + * @return the state value. + */ + public State state() { + return this.state; + } + + /** + * Set the state property: The state of the background job. + * + * @param state the state value to set. + * @return the BackgroundJob object itself. + */ + public BackgroundJob withState(State state) { + this.state = state; + return this; + } + + /** + * Get the executionState property: The execution state of the background job. + * + * @return the executionState value. + */ + public ExecutionState executionState() { + return this.executionState; + } + + /** + * Set the executionState property: The execution state of the background job. + * + * @param executionState the executionState value to set. + * @return the BackgroundJob object itself. + */ + public BackgroundJob withExecutionState(ExecutionState executionState) { + this.executionState = executionState; + return this; + } + + /** + * Get the startTime property: The start time of the background job. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start time of the background job. + * + * @param startTime the startTime value to set. + * @return the BackgroundJob object itself. + */ + public BackgroundJob withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: The end time of the background job. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: The end time of the background job. + * + * @param endTime the endTime value to set. + * @return the BackgroundJob object itself. + */ + public BackgroundJob withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the lastExecutionStatus property: The last execution status of the background job. + * + * @return the lastExecutionStatus value. + */ + public LastExecutionStatus lastExecutionStatus() { + return this.lastExecutionStatus; + } + + /** + * Set the lastExecutionStatus property: The last execution status of the background job. + * + * @param lastExecutionStatus the lastExecutionStatus value to set. + * @return the BackgroundJob object itself. + */ + public BackgroundJob withLastExecutionStatus(LastExecutionStatus lastExecutionStatus) { + this.lastExecutionStatus = lastExecutionStatus; + return this; + } + + /** + * Get the lastExecutionTime property: The last execution time of the background job. + * + * @return the lastExecutionTime value. + */ + public OffsetDateTime lastExecutionTime() { + return this.lastExecutionTime; + } + + /** + * Set the lastExecutionTime property: The last execution time of the background job. + * + * @param lastExecutionTime the lastExecutionTime value to set. + * @return the BackgroundJob object itself. + */ + public BackgroundJob withLastExecutionTime(OffsetDateTime lastExecutionTime) { + this.lastExecutionTime = lastExecutionTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeStringField("executionState", + this.executionState == null ? null : this.executionState.toString()); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + jsonWriter.writeStringField("lastExecutionStatus", + this.lastExecutionStatus == null ? null : this.lastExecutionStatus.toString()); + jsonWriter.writeStringField("lastExecutionTime", + this.lastExecutionTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastExecutionTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackgroundJob from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackgroundJob if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BackgroundJob. + */ + public static BackgroundJob fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackgroundJob deserializedBackgroundJob = new BackgroundJob(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedBackgroundJob.state = State.fromString(reader.getString()); + } else if ("executionState".equals(fieldName)) { + deserializedBackgroundJob.executionState = ExecutionState.fromString(reader.getString()); + } else if ("startTime".equals(fieldName)) { + deserializedBackgroundJob.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedBackgroundJob.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastExecutionStatus".equals(fieldName)) { + deserializedBackgroundJob.lastExecutionStatus = LastExecutionStatus.fromString(reader.getString()); + } else if ("lastExecutionTime".equals(fieldName)) { + deserializedBackgroundJob.lastExecutionTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedBackgroundJob; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BackupPolicy.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BackupPolicy.java new file mode 100644 index 000000000000..5bb3b597c622 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BackupPolicy.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The backup profile for the SQL server. + */ +@Fluent +public final class BackupPolicy implements JsonSerializable { + /* + * The retention period for all the databases in this managed instance. + */ + private Integer retentionPeriodDays; + + /* + * The value indicating days between full backups. + */ + private Integer fullBackupDays; + + /* + * The differential backup interval in hours. + */ + private DifferentialBackupHours differentialBackupHours; + + /* + * The value indicating minutes between transaction log backups. + */ + private Integer transactionLogBackupMinutes; + + /** + * Creates an instance of BackupPolicy class. + */ + public BackupPolicy() { + } + + /** + * Get the retentionPeriodDays property: The retention period for all the databases in this managed instance. + * + * @return the retentionPeriodDays value. + */ + public Integer retentionPeriodDays() { + return this.retentionPeriodDays; + } + + /** + * Set the retentionPeriodDays property: The retention period for all the databases in this managed instance. + * + * @param retentionPeriodDays the retentionPeriodDays value to set. + * @return the BackupPolicy object itself. + */ + public BackupPolicy withRetentionPeriodDays(Integer retentionPeriodDays) { + this.retentionPeriodDays = retentionPeriodDays; + return this; + } + + /** + * Get the fullBackupDays property: The value indicating days between full backups. + * + * @return the fullBackupDays value. + */ + public Integer fullBackupDays() { + return this.fullBackupDays; + } + + /** + * Set the fullBackupDays property: The value indicating days between full backups. + * + * @param fullBackupDays the fullBackupDays value to set. + * @return the BackupPolicy object itself. + */ + public BackupPolicy withFullBackupDays(Integer fullBackupDays) { + this.fullBackupDays = fullBackupDays; + return this; + } + + /** + * Get the differentialBackupHours property: The differential backup interval in hours. + * + * @return the differentialBackupHours value. + */ + public DifferentialBackupHours differentialBackupHours() { + return this.differentialBackupHours; + } + + /** + * Set the differentialBackupHours property: The differential backup interval in hours. + * + * @param differentialBackupHours the differentialBackupHours value to set. + * @return the BackupPolicy object itself. + */ + public BackupPolicy withDifferentialBackupHours(DifferentialBackupHours differentialBackupHours) { + this.differentialBackupHours = differentialBackupHours; + return this; + } + + /** + * Get the transactionLogBackupMinutes property: The value indicating minutes between transaction log backups. + * + * @return the transactionLogBackupMinutes value. + */ + public Integer transactionLogBackupMinutes() { + return this.transactionLogBackupMinutes; + } + + /** + * Set the transactionLogBackupMinutes property: The value indicating minutes between transaction log backups. + * + * @param transactionLogBackupMinutes the transactionLogBackupMinutes value to set. + * @return the BackupPolicy object itself. + */ + public BackupPolicy withTransactionLogBackupMinutes(Integer transactionLogBackupMinutes) { + this.transactionLogBackupMinutes = transactionLogBackupMinutes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("retentionPeriodDays", this.retentionPeriodDays); + jsonWriter.writeNumberField("fullBackupDays", this.fullBackupDays); + jsonWriter.writeNumberField("differentialBackupHours", + this.differentialBackupHours == null ? null : this.differentialBackupHours.toInt()); + jsonWriter.writeNumberField("transactionLogBackupMinutes", this.transactionLogBackupMinutes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupPolicy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupPolicy. + */ + public static BackupPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupPolicy deserializedBackupPolicy = new BackupPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("retentionPeriodDays".equals(fieldName)) { + deserializedBackupPolicy.retentionPeriodDays = reader.getNullable(JsonReader::getInt); + } else if ("fullBackupDays".equals(fieldName)) { + deserializedBackupPolicy.fullBackupDays = reader.getNullable(JsonReader::getInt); + } else if ("differentialBackupHours".equals(fieldName)) { + deserializedBackupPolicy.differentialBackupHours = DifferentialBackupHours.fromInt(reader.getInt()); + } else if ("transactionLogBackupMinutes".equals(fieldName)) { + deserializedBackupPolicy.transactionLogBackupMinutes = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupPolicy; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BasicLoginInformation.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BasicLoginInformation.java index 232339f4a46d..4dd4fd08cdc1 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BasicLoginInformation.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BasicLoginInformation.java @@ -5,30 +5,36 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** Username and password for basic login authentication. */ +/** + * Username and password for basic login authentication. + */ @Fluent -public final class BasicLoginInformation { +public final class BasicLoginInformation implements JsonSerializable { /* * Login username. */ - @JsonProperty(value = "username") private String username; /* * Login password. */ - @JsonProperty(value = "password") private String password; - /** Creates an instance of BasicLoginInformation class. */ + /** + * Creates an instance of BasicLoginInformation class. + */ public BasicLoginInformation() { } /** * Get the username property: Login username. - * + * * @return the username value. */ public String username() { @@ -37,7 +43,7 @@ public String username() { /** * Set the username property: Login username. - * + * * @param username the username value to set. * @return the BasicLoginInformation object itself. */ @@ -48,7 +54,7 @@ public BasicLoginInformation withUsername(String username) { /** * Get the password property: Login password. - * + * * @return the password value. */ public String password() { @@ -57,7 +63,7 @@ public String password() { /** * Set the password property: Login password. - * + * * @param password the password value to set. * @return the BasicLoginInformation object itself. */ @@ -68,9 +74,48 @@ public BasicLoginInformation withPassword(String password) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("username", this.username); + jsonWriter.writeStringField("password", this.password); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BasicLoginInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BasicLoginInformation if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the BasicLoginInformation. + */ + public static BasicLoginInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BasicLoginInformation deserializedBasicLoginInformation = new BasicLoginInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("username".equals(fieldName)) { + deserializedBasicLoginInformation.username = reader.getString(); + } else if ("password".equals(fieldName)) { + deserializedBasicLoginInformation.password = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBasicLoginInformation; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BillingPlan.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BillingPlan.java new file mode 100644 index 000000000000..99f20ec191c7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BillingPlan.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.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * SQL Server ESU license type. + */ +public final class BillingPlan extends ExpandableStringEnum { + /** + * Static value PAYG for BillingPlan. + */ + public static final BillingPlan PAYG = fromString("PAYG"); + + /** + * Static value Paid for BillingPlan. + */ + public static final BillingPlan PAID = fromString("Paid"); + + /** + * Creates a new instance of BillingPlan value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BillingPlan() { + } + + /** + * Creates or finds a BillingPlan from its string representation. + * + * @param name a name to look for. + * @return the corresponding BillingPlan. + */ + public static BillingPlan fromString(String name) { + return fromString(name, BillingPlan.class); + } + + /** + * Gets known BillingPlan values. + * + * @return known BillingPlan values. + */ + public static Collection values() { + return values(BillingPlan.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ClientConnection.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ClientConnection.java new file mode 100644 index 000000000000..9180d20022ed --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ClientConnection.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Client connection related configuration. + */ +@Fluent +public final class ClientConnection implements JsonSerializable { + /* + * Indicates if client connection is enabled for this SQL Server instance. + */ + private Boolean enabled; + + /** + * Creates an instance of ClientConnection class. + */ + public ClientConnection() { + } + + /** + * Get the enabled property: Indicates if client connection is enabled for this SQL Server instance. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates if client connection is enabled for this SQL Server instance. + * + * @param enabled the enabled value to set. + * @return the ClientConnection object itself. + */ + public ClientConnection withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientConnection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientConnection if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ClientConnection. + */ + public static ClientConnection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientConnection deserializedClientConnection = new ClientConnection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedClientConnection.enabled = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedClientConnection; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ClusterType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ClusterType.java new file mode 100644 index 000000000000..35ac4c6988e0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ClusterType.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.azurearcdata.models; + +/** + * Set to WSFC when availability group is on a failover cluster instance on a Windows Server failover cluster. Set to + * NONE when availability group not using WSFC for cluster coordination. + */ +public enum ClusterType { + /** + * Enum value WSFC. + */ + WSFC("WSFC"), + + /** + * Enum value NONE. + */ + NONE("NONE"); + + /** + * The actual serialized value for a ClusterType instance. + */ + private final String value; + + ClusterType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ClusterType instance. + * + * @param value the serialized value to parse. + * @return the parsed ClusterType object, or null if unable to parse. + */ + public static ClusterType fromString(String value) { + if (value == null) { + return null; + } + ClusterType[] items = ClusterType.values(); + for (ClusterType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/CommonSku.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/CommonSku.java new file mode 100644 index 000000000000..72be8872d1c0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/CommonSku.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The resource model definition representing SKU for ARM resources. + */ +@Fluent +public class CommonSku implements JsonSerializable { + /* + * The name of the SKU. It is typically a letter+number code + */ + private String name; + + /* + * Whether dev/test is enabled. When the dev field is set to true, the resource is used for dev/test purpose. + */ + private Boolean dev; + + /* + * The SKU size. When the name field is the combination of tier and some other value, this would be the standalone + * code. + */ + private String size; + + /* + * If the service has different generations of hardware, for the same SKU, then that can be captured here. + */ + private String family; + + /* + * If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible + * for the resource this may be omitted. + */ + private Integer capacity; + + /** + * Creates an instance of CommonSku class. + */ + public CommonSku() { + } + + /** + * Get the name property: The name of the SKU. It is typically a letter+number code. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the SKU. It is typically a letter+number code. + * + * @param name the name value to set. + * @return the CommonSku object itself. + */ + public CommonSku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the dev property: Whether dev/test is enabled. When the dev field is set to true, the resource is used for + * dev/test purpose. + * + * @return the dev value. + */ + public Boolean dev() { + return this.dev; + } + + /** + * Set the dev property: Whether dev/test is enabled. When the dev field is set to true, the resource is used for + * dev/test purpose. + * + * @param dev the dev value to set. + * @return the CommonSku object itself. + */ + public CommonSku withDev(Boolean dev) { + this.dev = dev; + return this; + } + + /** + * Get the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @param size the size value to set. + * @return the CommonSku object itself. + */ + public CommonSku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the family property: If the service has different generations of hardware, for the same SKU, then that can be + * captured here. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: If the service has different generations of hardware, for the same SKU, then that can be + * captured here. + * + * @param family the family value to set. + * @return the CommonSku object itself. + */ + public CommonSku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @param capacity the capacity value to set. + * @return the CommonSku object itself. + */ + public CommonSku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model CommonSku")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CommonSku.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeBooleanField("dev", this.dev); + jsonWriter.writeStringField("size", this.size); + jsonWriter.writeStringField("family", this.family); + jsonWriter.writeNumberField("capacity", this.capacity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommonSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommonSku if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CommonSku. + */ + public static CommonSku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommonSku deserializedCommonSku = new CommonSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCommonSku.name = reader.getString(); + } else if ("dev".equals(fieldName)) { + deserializedCommonSku.dev = reader.getNullable(JsonReader::getBoolean); + } else if ("size".equals(fieldName)) { + deserializedCommonSku.size = reader.getString(); + } else if ("family".equals(fieldName)) { + deserializedCommonSku.family = reader.getString(); + } else if ("capacity".equals(fieldName)) { + deserializedCommonSku.capacity = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedCommonSku; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ConnectionAuth.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ConnectionAuth.java new file mode 100644 index 000000000000..b4f53e1e528f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ConnectionAuth.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The endpoint connection authentication type(s). + */ +public final class ConnectionAuth extends ExpandableStringEnum { + /** + * Static value Windows_NTLM for ConnectionAuth. + */ + public static final ConnectionAuth WINDOWS_NTLM = fromString("Windows_NTLM"); + + /** + * Static value Windows_Kerberos for ConnectionAuth. + */ + public static final ConnectionAuth WINDOWS_KERBEROS = fromString("Windows_Kerberos"); + + /** + * Static value Windows_Negotiate for ConnectionAuth. + */ + public static final ConnectionAuth WINDOWS_NEGOTIATE = fromString("Windows_Negotiate"); + + /** + * Static value Certificate for ConnectionAuth. + */ + public static final ConnectionAuth CERTIFICATE = fromString("Certificate"); + + /** + * Static value Windows_NTLM_Certificate for ConnectionAuth. + */ + public static final ConnectionAuth WINDOWS_NTLM_CERTIFICATE = fromString("Windows_NTLM_Certificate"); + + /** + * Static value Windows_Kerberos_Certificate for ConnectionAuth. + */ + public static final ConnectionAuth WINDOWS_KERBEROS_CERTIFICATE = fromString("Windows_Kerberos_Certificate"); + + /** + * Static value Windows_Negotiate_Certificate for ConnectionAuth. + */ + public static final ConnectionAuth WINDOWS_NEGOTIATE_CERTIFICATE = fromString("Windows_Negotiate_Certificate"); + + /** + * Static value Certificate_Windows_NTLM for ConnectionAuth. + */ + public static final ConnectionAuth CERTIFICATE_WINDOWS_NTLM = fromString("Certificate_Windows_NTLM"); + + /** + * Static value Certificate_Windows_Kerberos for ConnectionAuth. + */ + public static final ConnectionAuth CERTIFICATE_WINDOWS_KERBEROS = fromString("Certificate_Windows_Kerberos"); + + /** + * Static value Certificate_Windows_Negotiate for ConnectionAuth. + */ + public static final ConnectionAuth CERTIFICATE_WINDOWS_NEGOTIATE = fromString("Certificate_Windows_Negotiate"); + + /** + * Creates a new instance of ConnectionAuth value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ConnectionAuth() { + } + + /** + * Creates or finds a ConnectionAuth from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConnectionAuth. + */ + public static ConnectionAuth fromString(String name) { + return fromString(name, ConnectionAuth.class); + } + + /** + * Gets known ConnectionAuth values. + * + * @return known ConnectionAuth values. + */ + public static Collection values() { + return values(ConnectionAuth.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ConnectionStatus.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ConnectionStatus.java index b6939dbe6271..624b6ce6e2a5 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ConnectionStatus.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ConnectionStatus.java @@ -5,23 +5,35 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** The cloud connectivity status. */ +/** + * The cloud connectivity status. + */ public final class ConnectionStatus extends ExpandableStringEnum { - /** Static value Connected for ConnectionStatus. */ + /** + * Static value Connected for ConnectionStatus. + */ public static final ConnectionStatus CONNECTED = fromString("Connected"); - /** Static value Disconnected for ConnectionStatus. */ + /** + * Static value Disconnected for ConnectionStatus. + */ public static final ConnectionStatus DISCONNECTED = fromString("Disconnected"); - /** Static value Unknown for ConnectionStatus. */ + /** + * Static value Registered for ConnectionStatus. + */ + public static final ConnectionStatus REGISTERED = fromString("Registered"); + + /** + * Static value Unknown for ConnectionStatus. + */ public static final ConnectionStatus UNKNOWN = fromString("Unknown"); /** * Creates a new instance of ConnectionStatus value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -30,18 +42,17 @@ public ConnectionStatus() { /** * Creates or finds a ConnectionStatus from its string representation. - * + * * @param name a name to look for. * @return the corresponding ConnectionStatus. */ - @JsonCreator public static ConnectionStatus fromString(String name) { return fromString(name, ConnectionStatus.class); } /** * Gets known ConnectionStatus values. - * + * * @return known ConnectionStatus values. */ public static Collection values() { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataBaseMigration.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataBaseMigration.java new file mode 100644 index 000000000000..6e8c7abe1dcf --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataBaseMigration.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Migration related configuration. + */ +@Fluent +public final class DataBaseMigration implements JsonSerializable { + /* + * Migration assessments related configuration. + */ + private DataBaseMigrationAssessment assessment; + + /** + * Creates an instance of DataBaseMigration class. + */ + public DataBaseMigration() { + } + + /** + * Get the assessment property: Migration assessments related configuration. + * + * @return the assessment value. + */ + public DataBaseMigrationAssessment assessment() { + return this.assessment; + } + + /** + * Set the assessment property: Migration assessments related configuration. + * + * @param assessment the assessment value to set. + * @return the DataBaseMigration object itself. + */ + public DataBaseMigration withAssessment(DataBaseMigrationAssessment assessment) { + this.assessment = assessment; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (assessment() != null) { + assessment().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("assessment", this.assessment); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataBaseMigration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataBaseMigration if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DataBaseMigration. + */ + public static DataBaseMigration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataBaseMigration deserializedDataBaseMigration = new DataBaseMigration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("assessment".equals(fieldName)) { + deserializedDataBaseMigration.assessment = DataBaseMigrationAssessment.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDataBaseMigration; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataBaseMigrationAssessment.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataBaseMigrationAssessment.java new file mode 100644 index 000000000000..2a1cb0a9c631 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataBaseMigrationAssessment.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * The migration assessment related configuration. + */ +@Immutable +public final class DataBaseMigrationAssessment implements JsonSerializable { + /* + * The time when Migration Assessment Report upload was last performed. + */ + private OffsetDateTime assessmentUploadTime; + + /* + * Issues and warnings impacting the migration of Database to particular Azure Migration Target. + */ + private List databaseAssessments; + + /* + * The target readiness for migration for this database. + */ + private TargetReadiness targetReadiness; + + /** + * Creates an instance of DataBaseMigrationAssessment class. + */ + public DataBaseMigrationAssessment() { + } + + /** + * Get the assessmentUploadTime property: The time when Migration Assessment Report upload was last performed. + * + * @return the assessmentUploadTime value. + */ + public OffsetDateTime assessmentUploadTime() { + return this.assessmentUploadTime; + } + + /** + * Get the databaseAssessments property: Issues and warnings impacting the migration of Database to particular Azure + * Migration Target. + * + * @return the databaseAssessments value. + */ + public List databaseAssessments() { + return this.databaseAssessments; + } + + /** + * Get the targetReadiness property: The target readiness for migration for this database. + * + * @return the targetReadiness value. + */ + public TargetReadiness targetReadiness() { + return this.targetReadiness; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (databaseAssessments() != null) { + databaseAssessments().forEach(e -> e.validate()); + } + if (targetReadiness() != null) { + targetReadiness().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataBaseMigrationAssessment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataBaseMigrationAssessment if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DataBaseMigrationAssessment. + */ + public static DataBaseMigrationAssessment fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataBaseMigrationAssessment deserializedDataBaseMigrationAssessment = new DataBaseMigrationAssessment(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("assessmentUploadTime".equals(fieldName)) { + deserializedDataBaseMigrationAssessment.assessmentUploadTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("databaseAssessments".equals(fieldName)) { + List databaseAssessments + = reader.readArray(reader1 -> DatabaseAssessmentsItem.fromJson(reader1)); + deserializedDataBaseMigrationAssessment.databaseAssessments = databaseAssessments; + } else if ("targetReadiness".equals(fieldName)) { + deserializedDataBaseMigrationAssessment.targetReadiness = TargetReadiness.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDataBaseMigrationAssessment; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerProperties.java index 8911372816c7..d6b6f482a32f 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerProperties.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerProperties.java @@ -5,86 +5,96 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; -/** The data controller properties. */ +/** + * The data controller properties. + */ @Fluent -public final class DataControllerProperties { +public final class DataControllerProperties implements JsonSerializable { /* * The infrastructure the data controller is running on. */ - @JsonProperty(value = "infrastructure") private Infrastructure infrastructure; /* * Properties from the Kubernetes data controller */ - @JsonProperty(value = "onPremiseProperty") private OnPremiseProperty onPremiseProperty; /* * The raw kubernetes information */ - @JsonProperty(value = "k8sRaw") private Object k8SRaw; /* - * Properties on upload watermark. Mostly timestamp for each upload data type + * Properties on upload watermark. Mostly timestamp for each upload data type */ - @JsonProperty(value = "uploadWatermark") private UploadWatermark uploadWatermark; /* * Last uploaded date from Kubernetes cluster. Defaults to current date time */ - @JsonProperty(value = "lastUploadedDate") private OffsetDateTime lastUploadedDate; /* - * Username and password for basic login authentication. + * Deprecated. Azure Arc Data Services data controller no longer expose any endpoint. All traffic are exposed + * through Kubernetes native API. */ - @JsonProperty(value = "basicLoginInformation") private BasicLoginInformation basicLoginInformation; + /* + * Login credential for metrics dashboard on the Kubernetes cluster. + */ + private BasicLoginInformation metricsDashboardCredential; + + /* + * Login credential for logs dashboard on the Kubernetes cluster. + */ + private BasicLoginInformation logsDashboardCredential; + /* * Log analytics workspace id and primary key */ - @JsonProperty(value = "logAnalyticsWorkspaceConfig") private LogAnalyticsWorkspaceConfig logAnalyticsWorkspaceConfig; /* - * Service principal for uploading billing, metrics and logs. + * Deprecated. Service principal is deprecated in favor of Arc Kubernetes service extension managed identity. */ - @JsonProperty(value = "uploadServicePrincipal") private UploadServicePrincipal uploadServicePrincipal; /* - * The provisioningState property. + * The provisioning state of the Arc Data Controller resource. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private String provisioningState; /* * If a CustomLocation is provided, this contains the ARM id of the connected cluster the custom location belongs * to. */ - @JsonProperty(value = "clusterId") private String clusterId; /* * If a CustomLocation is provided, this contains the ARM id of the extension the custom location belongs to. */ - @JsonProperty(value = "extensionId") private String extensionId; - /** Creates an instance of DataControllerProperties class. */ + /** + * Creates an instance of DataControllerProperties class. + */ public DataControllerProperties() { } /** * Get the infrastructure property: The infrastructure the data controller is running on. - * + * * @return the infrastructure value. */ public Infrastructure infrastructure() { @@ -93,7 +103,7 @@ public Infrastructure infrastructure() { /** * Set the infrastructure property: The infrastructure the data controller is running on. - * + * * @param infrastructure the infrastructure value to set. * @return the DataControllerProperties object itself. */ @@ -104,7 +114,7 @@ public DataControllerProperties withInfrastructure(Infrastructure infrastructure /** * Get the onPremiseProperty property: Properties from the Kubernetes data controller. - * + * * @return the onPremiseProperty value. */ public OnPremiseProperty onPremiseProperty() { @@ -113,7 +123,7 @@ public OnPremiseProperty onPremiseProperty() { /** * Set the onPremiseProperty property: Properties from the Kubernetes data controller. - * + * * @param onPremiseProperty the onPremiseProperty value to set. * @return the DataControllerProperties object itself. */ @@ -124,7 +134,7 @@ public DataControllerProperties withOnPremiseProperty(OnPremiseProperty onPremis /** * Get the k8SRaw property: The raw kubernetes information. - * + * * @return the k8SRaw value. */ public Object k8SRaw() { @@ -133,7 +143,7 @@ public Object k8SRaw() { /** * Set the k8SRaw property: The raw kubernetes information. - * + * * @param k8SRaw the k8SRaw value to set. * @return the DataControllerProperties object itself. */ @@ -144,7 +154,7 @@ public DataControllerProperties withK8SRaw(Object k8SRaw) { /** * Get the uploadWatermark property: Properties on upload watermark. Mostly timestamp for each upload data type. - * + * * @return the uploadWatermark value. */ public UploadWatermark uploadWatermark() { @@ -153,7 +163,7 @@ public UploadWatermark uploadWatermark() { /** * Set the uploadWatermark property: Properties on upload watermark. Mostly timestamp for each upload data type. - * + * * @param uploadWatermark the uploadWatermark value to set. * @return the DataControllerProperties object itself. */ @@ -164,7 +174,7 @@ public DataControllerProperties withUploadWatermark(UploadWatermark uploadWaterm /** * Get the lastUploadedDate property: Last uploaded date from Kubernetes cluster. Defaults to current date time. - * + * * @return the lastUploadedDate value. */ public OffsetDateTime lastUploadedDate() { @@ -173,7 +183,7 @@ public OffsetDateTime lastUploadedDate() { /** * Set the lastUploadedDate property: Last uploaded date from Kubernetes cluster. Defaults to current date time. - * + * * @param lastUploadedDate the lastUploadedDate value to set. * @return the DataControllerProperties object itself. */ @@ -183,8 +193,9 @@ public DataControllerProperties withLastUploadedDate(OffsetDateTime lastUploaded } /** - * Get the basicLoginInformation property: Username and password for basic login authentication. - * + * Get the basicLoginInformation property: Deprecated. Azure Arc Data Services data controller no longer expose any + * endpoint. All traffic are exposed through Kubernetes native API. + * * @return the basicLoginInformation value. */ public BasicLoginInformation basicLoginInformation() { @@ -192,8 +203,9 @@ public BasicLoginInformation basicLoginInformation() { } /** - * Set the basicLoginInformation property: Username and password for basic login authentication. - * + * Set the basicLoginInformation property: Deprecated. Azure Arc Data Services data controller no longer expose any + * endpoint. All traffic are exposed through Kubernetes native API. + * * @param basicLoginInformation the basicLoginInformation value to set. * @return the DataControllerProperties object itself. */ @@ -202,9 +214,49 @@ public DataControllerProperties withBasicLoginInformation(BasicLoginInformation return this; } + /** + * Get the metricsDashboardCredential property: Login credential for metrics dashboard on the Kubernetes cluster. + * + * @return the metricsDashboardCredential value. + */ + public BasicLoginInformation metricsDashboardCredential() { + return this.metricsDashboardCredential; + } + + /** + * Set the metricsDashboardCredential property: Login credential for metrics dashboard on the Kubernetes cluster. + * + * @param metricsDashboardCredential the metricsDashboardCredential value to set. + * @return the DataControllerProperties object itself. + */ + public DataControllerProperties withMetricsDashboardCredential(BasicLoginInformation metricsDashboardCredential) { + this.metricsDashboardCredential = metricsDashboardCredential; + return this; + } + + /** + * Get the logsDashboardCredential property: Login credential for logs dashboard on the Kubernetes cluster. + * + * @return the logsDashboardCredential value. + */ + public BasicLoginInformation logsDashboardCredential() { + return this.logsDashboardCredential; + } + + /** + * Set the logsDashboardCredential property: Login credential for logs dashboard on the Kubernetes cluster. + * + * @param logsDashboardCredential the logsDashboardCredential value to set. + * @return the DataControllerProperties object itself. + */ + public DataControllerProperties withLogsDashboardCredential(BasicLoginInformation logsDashboardCredential) { + this.logsDashboardCredential = logsDashboardCredential; + return this; + } + /** * Get the logAnalyticsWorkspaceConfig property: Log analytics workspace id and primary key. - * + * * @return the logAnalyticsWorkspaceConfig value. */ public LogAnalyticsWorkspaceConfig logAnalyticsWorkspaceConfig() { @@ -213,19 +265,20 @@ public LogAnalyticsWorkspaceConfig logAnalyticsWorkspaceConfig() { /** * Set the logAnalyticsWorkspaceConfig property: Log analytics workspace id and primary key. - * + * * @param logAnalyticsWorkspaceConfig the logAnalyticsWorkspaceConfig value to set. * @return the DataControllerProperties object itself. */ - public DataControllerProperties withLogAnalyticsWorkspaceConfig( - LogAnalyticsWorkspaceConfig logAnalyticsWorkspaceConfig) { + public DataControllerProperties + withLogAnalyticsWorkspaceConfig(LogAnalyticsWorkspaceConfig logAnalyticsWorkspaceConfig) { this.logAnalyticsWorkspaceConfig = logAnalyticsWorkspaceConfig; return this; } /** - * Get the uploadServicePrincipal property: Service principal for uploading billing, metrics and logs. - * + * Get the uploadServicePrincipal property: Deprecated. Service principal is deprecated in favor of Arc Kubernetes + * service extension managed identity. + * * @return the uploadServicePrincipal value. */ public UploadServicePrincipal uploadServicePrincipal() { @@ -233,8 +286,9 @@ public UploadServicePrincipal uploadServicePrincipal() { } /** - * Set the uploadServicePrincipal property: Service principal for uploading billing, metrics and logs. - * + * Set the uploadServicePrincipal property: Deprecated. Service principal is deprecated in favor of Arc Kubernetes + * service extension managed identity. + * * @param uploadServicePrincipal the uploadServicePrincipal value to set. * @return the DataControllerProperties object itself. */ @@ -244,8 +298,8 @@ public DataControllerProperties withUploadServicePrincipal(UploadServicePrincipa } /** - * Get the provisioningState property: The provisioningState property. - * + * Get the provisioningState property: The provisioning state of the Arc Data Controller resource. + * * @return the provisioningState value. */ public String provisioningState() { @@ -255,7 +309,7 @@ public String provisioningState() { /** * Get the clusterId property: If a CustomLocation is provided, this contains the ARM id of the connected cluster * the custom location belongs to. - * + * * @return the clusterId value. */ public String clusterId() { @@ -265,7 +319,7 @@ public String clusterId() { /** * Set the clusterId property: If a CustomLocation is provided, this contains the ARM id of the connected cluster * the custom location belongs to. - * + * * @param clusterId the clusterId value to set. * @return the DataControllerProperties object itself. */ @@ -277,7 +331,7 @@ public DataControllerProperties withClusterId(String clusterId) { /** * Get the extensionId property: If a CustomLocation is provided, this contains the ARM id of the extension the * custom location belongs to. - * + * * @return the extensionId value. */ public String extensionId() { @@ -287,7 +341,7 @@ public String extensionId() { /** * Set the extensionId property: If a CustomLocation is provided, this contains the ARM id of the extension the * custom location belongs to. - * + * * @param extensionId the extensionId value to set. * @return the DataControllerProperties object itself. */ @@ -298,7 +352,7 @@ public DataControllerProperties withExtensionId(String extensionId) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -311,6 +365,12 @@ public void validate() { if (basicLoginInformation() != null) { basicLoginInformation().validate(); } + if (metricsDashboardCredential() != null) { + metricsDashboardCredential().validate(); + } + if (logsDashboardCredential() != null) { + logsDashboardCredential().validate(); + } if (logAnalyticsWorkspaceConfig() != null) { logAnalyticsWorkspaceConfig().validate(); } @@ -318,4 +378,84 @@ public void validate() { uploadServicePrincipal().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("infrastructure", + this.infrastructure == null ? null : this.infrastructure.toString()); + jsonWriter.writeJsonField("onPremiseProperty", this.onPremiseProperty); + jsonWriter.writeUntypedField("k8sRaw", this.k8SRaw); + jsonWriter.writeJsonField("uploadWatermark", this.uploadWatermark); + jsonWriter.writeStringField("lastUploadedDate", + this.lastUploadedDate == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUploadedDate)); + jsonWriter.writeJsonField("basicLoginInformation", this.basicLoginInformation); + jsonWriter.writeJsonField("metricsDashboardCredential", this.metricsDashboardCredential); + jsonWriter.writeJsonField("logsDashboardCredential", this.logsDashboardCredential); + jsonWriter.writeJsonField("logAnalyticsWorkspaceConfig", this.logAnalyticsWorkspaceConfig); + jsonWriter.writeJsonField("uploadServicePrincipal", this.uploadServicePrincipal); + jsonWriter.writeStringField("clusterId", this.clusterId); + jsonWriter.writeStringField("extensionId", this.extensionId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataControllerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataControllerProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DataControllerProperties. + */ + public static DataControllerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataControllerProperties deserializedDataControllerProperties = new DataControllerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("infrastructure".equals(fieldName)) { + deserializedDataControllerProperties.infrastructure = Infrastructure.fromString(reader.getString()); + } else if ("onPremiseProperty".equals(fieldName)) { + deserializedDataControllerProperties.onPremiseProperty = OnPremiseProperty.fromJson(reader); + } else if ("k8sRaw".equals(fieldName)) { + deserializedDataControllerProperties.k8SRaw = reader.readUntyped(); + } else if ("uploadWatermark".equals(fieldName)) { + deserializedDataControllerProperties.uploadWatermark = UploadWatermark.fromJson(reader); + } else if ("lastUploadedDate".equals(fieldName)) { + deserializedDataControllerProperties.lastUploadedDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("basicLoginInformation".equals(fieldName)) { + deserializedDataControllerProperties.basicLoginInformation = BasicLoginInformation.fromJson(reader); + } else if ("metricsDashboardCredential".equals(fieldName)) { + deserializedDataControllerProperties.metricsDashboardCredential + = BasicLoginInformation.fromJson(reader); + } else if ("logsDashboardCredential".equals(fieldName)) { + deserializedDataControllerProperties.logsDashboardCredential + = BasicLoginInformation.fromJson(reader); + } else if ("logAnalyticsWorkspaceConfig".equals(fieldName)) { + deserializedDataControllerProperties.logAnalyticsWorkspaceConfig + = LogAnalyticsWorkspaceConfig.fromJson(reader); + } else if ("uploadServicePrincipal".equals(fieldName)) { + deserializedDataControllerProperties.uploadServicePrincipal + = UploadServicePrincipal.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedDataControllerProperties.provisioningState = reader.getString(); + } else if ("clusterId".equals(fieldName)) { + deserializedDataControllerProperties.clusterId = reader.getString(); + } else if ("extensionId".equals(fieldName)) { + deserializedDataControllerProperties.extensionId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDataControllerProperties; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerResource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerResource.java index 9f1d9a765414..24b0ed844217 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerResource.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerResource.java @@ -10,110 +10,118 @@ import com.azure.resourcemanager.azurearcdata.fluent.models.DataControllerResourceInner; import java.util.Map; -/** An immutable client-side representation of DataControllerResource. */ +/** + * An immutable client-side representation of DataControllerResource. + */ public interface DataControllerResource { /** * 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 extendedLocation property: The extendedLocation of the resource. - * + * * @return the extendedLocation value. */ ExtendedLocation extendedLocation(); /** * Gets the properties property: The data controller's properties. - * + * * @return the properties value. */ DataControllerProperties properties(); /** - * Gets the systemData property: Read only system data. - * + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * * @return the systemData value. */ SystemData systemData(); /** * 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.azurearcdata.fluent.models.DataControllerResourceInner object. - * + * * @return the inner object. */ DataControllerResourceInner innerModel(); - /** The entirety of the DataControllerResource definition. */ - interface Definition - extends DefinitionStages.Blank, - DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, - DefinitionStages.WithProperties, - DefinitionStages.WithCreate { + /** + * The entirety of the DataControllerResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithProperties, DefinitionStages.WithCreate { } - /** The DataControllerResource definition stages. */ + + /** + * The DataControllerResource definition stages. + */ interface DefinitionStages { - /** The first stage of the DataControllerResource definition. */ + /** + * The first stage of the DataControllerResource definition. + */ interface Blank extends WithLocation { } - /** The stage of the DataControllerResource definition allowing to specify location. */ + + /** + * The stage of the DataControllerResource 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. */ @@ -121,32 +129,39 @@ interface WithLocation { /** * 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 DataControllerResource definition allowing to specify parent resource. */ + + /** + * The stage of the DataControllerResource definition allowing to specify parent resource. + */ interface WithResourceGroup { /** * Specifies resourceGroupName. - * + * * @param resourceGroupName The name of the Azure resource group. * @return the next definition stage. */ WithProperties withExistingResourceGroup(String resourceGroupName); } - /** The stage of the DataControllerResource definition allowing to specify properties. */ + + /** + * The stage of the DataControllerResource definition allowing to specify properties. + */ interface WithProperties { /** * Specifies the properties property: The data controller's properties. - * + * * @param properties The data controller's properties. * @return the next definition stage. */ WithCreate withProperties(DataControllerProperties properties); } + /** * The stage of the DataControllerResource 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. @@ -154,87 +169,115 @@ interface WithProperties { interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithExtendedLocation { /** * Executes the create request. - * + * * @return the created resource. */ DataControllerResource create(); /** * Executes the create request. - * + * * @param context The context to associate with this operation. * @return the created resource. */ DataControllerResource create(Context context); } - /** The stage of the DataControllerResource definition allowing to specify tags. */ + + /** + * The stage of the DataControllerResource 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 DataControllerResource definition allowing to specify extendedLocation. */ + + /** + * The stage of the DataControllerResource definition allowing to specify extendedLocation. + */ interface WithExtendedLocation { /** * Specifies the extendedLocation property: The extendedLocation of the resource.. - * + * * @param extendedLocation The extendedLocation of the resource. * @return the next definition stage. */ WithCreate withExtendedLocation(ExtendedLocation extendedLocation); } } + /** * Begins update for the DataControllerResource resource. - * + * * @return the stage of resource update. */ DataControllerResource.Update update(); - /** The template for DataControllerResource update. */ - interface Update extends UpdateStages.WithTags { + /** + * The template for DataControllerResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { /** * Executes the update request. - * + * * @return the updated resource. */ DataControllerResource apply(); /** * Executes the update request. - * + * * @param context The context to associate with this operation. * @return the updated resource. */ DataControllerResource apply(Context context); } - /** The DataControllerResource update stages. */ + + /** + * The DataControllerResource update stages. + */ interface UpdateStages { - /** The stage of the DataControllerResource update allowing to specify tags. */ + /** + * The stage of the DataControllerResource update allowing to specify tags. + */ interface WithTags { /** * Specifies the tags property: Resource tags. - * + * * @param tags Resource tags. * @return the next definition stage. */ Update withTags(Map tags); } + + /** + * The stage of the DataControllerResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The data controller's properties. + * + * @param properties The data controller's properties. + * @return the next definition stage. + */ + Update withProperties(DataControllerProperties properties); + } } + /** * Refreshes the resource to sync with Azure. - * + * * @return the refreshed resource. */ DataControllerResource refresh(); /** * Refreshes the resource to sync with Azure. - * + * * @param context The context to associate with this operation. * @return the refreshed resource. */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerUpdate.java index 6675fcd0b8f3..54c361dbcad1 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerUpdate.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerUpdate.java @@ -5,27 +5,37 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; -/** Used for updating a data controller resource. */ +/** + * Used for updating a data controller resource. + */ @Fluent -public final class DataControllerUpdate { +public final class DataControllerUpdate implements JsonSerializable { /* * Resource tags */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; - /** Creates an instance of DataControllerUpdate class. */ + /* + * The data controller's properties + */ + private DataControllerProperties properties; + + /** + * Creates an instance of DataControllerUpdate class. + */ public DataControllerUpdate() { } /** * Get the tags property: Resource tags. - * + * * @return the tags value. */ public Map tags() { @@ -34,7 +44,7 @@ public Map tags() { /** * Set the tags property: Resource tags. - * + * * @param tags the tags value to set. * @return the DataControllerUpdate object itself. */ @@ -43,11 +53,74 @@ public DataControllerUpdate withTags(Map tags) { return this; } + /** + * Get the properties property: The data controller's properties. + * + * @return the properties value. + */ + public DataControllerProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The data controller's properties. + * + * @param properties the properties value to set. + * @return the DataControllerUpdate object itself. + */ + public DataControllerUpdate withProperties(DataControllerProperties properties) { + this.properties = properties; + return this; + } + /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataControllerUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataControllerUpdate if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the DataControllerUpdate. + */ + public static DataControllerUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataControllerUpdate deserializedDataControllerUpdate = new DataControllerUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDataControllerUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedDataControllerUpdate.properties = DataControllerProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDataControllerUpdate; + }); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllers.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllers.java index 996dc63864d0..59889712551d 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllers.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllers.java @@ -8,56 +8,58 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of DataControllers. */ +/** + * Resource collection API of DataControllers. + */ public interface DataControllers { /** * List dataController resources in the 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 the paginated response with {@link PagedIterable}. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ PagedIterable list(); /** * List dataController resources in the 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 the paginated response with {@link PagedIterable}. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ PagedIterable list(Context context); /** * List dataController resources in the resource group. - * + * * @param resourceGroupName The name of the Azure resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroupName); /** * List dataController resources in the resource group. - * + * * @param resourceGroupName The name of the Azure resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroupName, Context context); /** * Deletes a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -66,9 +68,9 @@ public interface DataControllers { /** * Deletes a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -78,23 +80,23 @@ public interface DataControllers { /** * Retrieves a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data controller resource along with {@link Response}. */ - Response getByResourceGroupWithResponse( - String resourceGroupName, String dataControllerName, Context context); + Response getByResourceGroupWithResponse(String resourceGroupName, String dataControllerName, + Context context); /** * Retrieves a dataController resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -104,7 +106,7 @@ Response getByResourceGroupWithResponse( /** * Retrieves a dataController resource. - * + * * @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. @@ -115,7 +117,7 @@ Response getByResourceGroupWithResponse( /** * Retrieves a dataController resource. - * + * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -127,7 +129,7 @@ Response getByResourceGroupWithResponse( /** * Deletes a dataController resource. - * + * * @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. @@ -137,7 +139,7 @@ Response getByResourceGroupWithResponse( /** * Deletes a dataController resource. - * + * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -148,7 +150,7 @@ Response getByResourceGroupWithResponse( /** * Begins definition for a new DataControllerResource resource. - * + * * @param name resource name. * @return the first stage of the new DataControllerResource definition. */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseAssessmentsItem.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseAssessmentsItem.java new file mode 100644 index 000000000000..071b02545fcc --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseAssessmentsItem.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The DatabaseAssessmentsItem model. + */ +@Fluent +public final class DatabaseAssessmentsItem implements JsonSerializable { + /* + * The appliesToMigrationTargetPlatform property. + */ + private String appliesToMigrationTargetPlatform; + + /* + * The featureId property. + */ + private String featureId; + + /* + * The issueCategory property. + */ + private String issueCategory; + + /* + * The moreInformation property. + */ + private String moreInformation; + + /** + * Creates an instance of DatabaseAssessmentsItem class. + */ + public DatabaseAssessmentsItem() { + } + + /** + * Get the appliesToMigrationTargetPlatform property: The appliesToMigrationTargetPlatform property. + * + * @return the appliesToMigrationTargetPlatform value. + */ + public String appliesToMigrationTargetPlatform() { + return this.appliesToMigrationTargetPlatform; + } + + /** + * Set the appliesToMigrationTargetPlatform property: The appliesToMigrationTargetPlatform property. + * + * @param appliesToMigrationTargetPlatform the appliesToMigrationTargetPlatform value to set. + * @return the DatabaseAssessmentsItem object itself. + */ + public DatabaseAssessmentsItem withAppliesToMigrationTargetPlatform(String appliesToMigrationTargetPlatform) { + this.appliesToMigrationTargetPlatform = appliesToMigrationTargetPlatform; + return this; + } + + /** + * Get the featureId property: The featureId property. + * + * @return the featureId value. + */ + public String featureId() { + return this.featureId; + } + + /** + * Set the featureId property: The featureId property. + * + * @param featureId the featureId value to set. + * @return the DatabaseAssessmentsItem object itself. + */ + public DatabaseAssessmentsItem withFeatureId(String featureId) { + this.featureId = featureId; + return this; + } + + /** + * Get the issueCategory property: The issueCategory property. + * + * @return the issueCategory value. + */ + public String issueCategory() { + return this.issueCategory; + } + + /** + * Set the issueCategory property: The issueCategory property. + * + * @param issueCategory the issueCategory value to set. + * @return the DatabaseAssessmentsItem object itself. + */ + public DatabaseAssessmentsItem withIssueCategory(String issueCategory) { + this.issueCategory = issueCategory; + return this; + } + + /** + * Get the moreInformation property: The moreInformation property. + * + * @return the moreInformation value. + */ + public String moreInformation() { + return this.moreInformation; + } + + /** + * Set the moreInformation property: The moreInformation property. + * + * @param moreInformation the moreInformation value to set. + * @return the DatabaseAssessmentsItem object itself. + */ + public DatabaseAssessmentsItem withMoreInformation(String moreInformation) { + this.moreInformation = moreInformation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("appliesToMigrationTargetPlatform", this.appliesToMigrationTargetPlatform); + jsonWriter.writeStringField("featureId", this.featureId); + jsonWriter.writeStringField("issueCategory", this.issueCategory); + jsonWriter.writeStringField("moreInformation", this.moreInformation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseAssessmentsItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseAssessmentsItem if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the DatabaseAssessmentsItem. + */ + public static DatabaseAssessmentsItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseAssessmentsItem deserializedDatabaseAssessmentsItem = new DatabaseAssessmentsItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("appliesToMigrationTargetPlatform".equals(fieldName)) { + deserializedDatabaseAssessmentsItem.appliesToMigrationTargetPlatform = reader.getString(); + } else if ("featureId".equals(fieldName)) { + deserializedDatabaseAssessmentsItem.featureId = reader.getString(); + } else if ("issueCategory".equals(fieldName)) { + deserializedDatabaseAssessmentsItem.issueCategory = reader.getString(); + } else if ("moreInformation".equals(fieldName)) { + deserializedDatabaseAssessmentsItem.moreInformation = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseAssessmentsItem; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseCreateMode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseCreateMode.java new file mode 100644 index 000000000000..526126b60f5c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseCreateMode.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing + * database. sourceDatabaseId and restorePointInTime must be specified. + */ +public final class DatabaseCreateMode extends ExpandableStringEnum { + /** + * Static value Default for DatabaseCreateMode. + */ + public static final DatabaseCreateMode DEFAULT = fromString("Default"); + + /** + * Static value PointInTimeRestore for DatabaseCreateMode. + */ + public static final DatabaseCreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** + * Creates a new instance of DatabaseCreateMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DatabaseCreateMode() { + } + + /** + * Creates or finds a DatabaseCreateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding DatabaseCreateMode. + */ + public static DatabaseCreateMode fromString(String name) { + return fromString(name, DatabaseCreateMode.class); + } + + /** + * Gets known DatabaseCreateMode values. + * + * @return known DatabaseCreateMode values. + */ + public static Collection values() { + return values(DatabaseCreateMode.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseState.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseState.java new file mode 100644 index 000000000000..e80e9d487dca --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseState.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * State of the database. + */ +public final class DatabaseState extends ExpandableStringEnum { + /** + * Static value Online for DatabaseState. + */ + public static final DatabaseState ONLINE = fromString("Online"); + + /** + * Static value Restoring for DatabaseState. + */ + public static final DatabaseState RESTORING = fromString("Restoring"); + + /** + * Static value Recovering for DatabaseState. + */ + public static final DatabaseState RECOVERING = fromString("Recovering"); + + /** + * Static value RecoveryPending for DatabaseState. + */ + public static final DatabaseState RECOVERY_PENDING = fromString("RecoveryPending"); + + /** + * Static value Suspect for DatabaseState. + */ + public static final DatabaseState SUSPECT = fromString("Suspect"); + + /** + * Static value Emergency for DatabaseState. + */ + public static final DatabaseState EMERGENCY = fromString("Emergency"); + + /** + * Static value Offline for DatabaseState. + */ + public static final DatabaseState OFFLINE = fromString("Offline"); + + /** + * Static value Copying for DatabaseState. + */ + public static final DatabaseState COPYING = fromString("Copying"); + + /** + * Static value OfflineSecondary for DatabaseState. + */ + public static final DatabaseState OFFLINE_SECONDARY = fromString("OfflineSecondary"); + + /** + * Creates a new instance of DatabaseState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DatabaseState() { + } + + /** + * Creates or finds a DatabaseState from its string representation. + * + * @param name a name to look for. + * @return the corresponding DatabaseState. + */ + public static DatabaseState fromString(String name) { + return fromString(name, DatabaseState.class); + } + + /** + * Gets known DatabaseState values. + * + * @return known DatabaseState values. + */ + public static Collection values() { + return values(DatabaseState.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Databases.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Databases.java new file mode 100644 index 000000000000..7983581c7789 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Databases.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * List of database names. + */ +@Fluent +public final class Databases implements JsonSerializable { + /* + * List of database names. + */ + private List values; + + /** + * Creates an instance of Databases class. + */ + public Databases() { + } + + /** + * Get the values property: List of database names. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: List of database names. + * + * @param values the values value to set. + * @return the Databases object itself. + */ + public Databases withValues(List values) { + this.values = values; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("values", this.values, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Databases from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Databases if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Databases. + */ + public static Databases fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Databases deserializedDatabases = new Databases(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("values".equals(fieldName)) { + List values = reader.readArray(reader1 -> reader1.getString()); + deserializedDatabases.values = values; + } else { + reader.skipChildren(); + } + } + + return deserializedDatabases; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DbFailover.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DbFailover.java new file mode 100644 index 000000000000..1d2b83a3c3be --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DbFailover.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * Specifies whether the availability group supports failover for database health conditions. + */ +public enum DbFailover { + /** + * Enum value ON. + */ + ON("ON"), + + /** + * Enum value OFF. + */ + OFF("OFF"); + + /** + * The actual serialized value for a DbFailover instance. + */ + private final String value; + + DbFailover(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DbFailover instance. + * + * @param value the serialized value to parse. + * @return the parsed DbFailover object, or null if unable to parse. + */ + public static DbFailover fromString(String value) { + if (value == null) { + return null; + } + DbFailover[] items = DbFailover.values(); + for (DbFailover item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DbmEndpoint.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DbmEndpoint.java new file mode 100644 index 000000000000..7081508215c3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DbmEndpoint.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Database mirroring endpoint related properties. + */ +@Immutable +public final class DbmEndpoint implements JsonSerializable { + /* + * Name of the database mirroring endpoint. + */ + private String endpointName; + + /* + * Mirroring Role + */ + private Role role; + + /* + * Is Encryption enabled + */ + private Boolean isEncryptionEnabled; + + /* + * Encryption Algorithm + */ + private EncryptionAlgorithm encryptionAlgorithm; + + /* + * The type of connection authentication required for connections to this endpoint + */ + private ConnectionAuth connectionAuth; + + /* + * The port number that the endpoint is listening on. + */ + private Integer port; + + /* + * Is the port number dynamically assigned. + */ + private Boolean isDynamicPort; + + /* + * Listener IP address. + */ + private String ipAddress; + + /* + * Name of the certificate. + */ + private String certificateName; + + /** + * Creates an instance of DbmEndpoint class. + */ + public DbmEndpoint() { + } + + /** + * Get the endpointName property: Name of the database mirroring endpoint. + * + * @return the endpointName value. + */ + public String endpointName() { + return this.endpointName; + } + + /** + * Get the role property: Mirroring Role. + * + * @return the role value. + */ + public Role role() { + return this.role; + } + + /** + * Get the isEncryptionEnabled property: Is Encryption enabled. + * + * @return the isEncryptionEnabled value. + */ + public Boolean isEncryptionEnabled() { + return this.isEncryptionEnabled; + } + + /** + * Get the encryptionAlgorithm property: Encryption Algorithm. + * + * @return the encryptionAlgorithm value. + */ + public EncryptionAlgorithm encryptionAlgorithm() { + return this.encryptionAlgorithm; + } + + /** + * Get the connectionAuth property: The type of connection authentication required for connections to this endpoint. + * + * @return the connectionAuth value. + */ + public ConnectionAuth connectionAuth() { + return this.connectionAuth; + } + + /** + * Get the port property: The port number that the endpoint is listening on. + * + * @return the port value. + */ + public Integer port() { + return this.port; + } + + /** + * Get the isDynamicPort property: Is the port number dynamically assigned. + * + * @return the isDynamicPort value. + */ + public Boolean isDynamicPort() { + return this.isDynamicPort; + } + + /** + * Get the ipAddress property: Listener IP address. + * + * @return the ipAddress value. + */ + public String ipAddress() { + return this.ipAddress; + } + + /** + * Get the certificateName property: Name of the certificate. + * + * @return the certificateName value. + */ + public String certificateName() { + return this.certificateName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DbmEndpoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DbmEndpoint if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DbmEndpoint. + */ + public static DbmEndpoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DbmEndpoint deserializedDbmEndpoint = new DbmEndpoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("endpointName".equals(fieldName)) { + deserializedDbmEndpoint.endpointName = reader.getString(); + } else if ("role".equals(fieldName)) { + deserializedDbmEndpoint.role = Role.fromString(reader.getString()); + } else if ("isEncryptionEnabled".equals(fieldName)) { + deserializedDbmEndpoint.isEncryptionEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("encryptionAlgorithm".equals(fieldName)) { + deserializedDbmEndpoint.encryptionAlgorithm = EncryptionAlgorithm.fromString(reader.getString()); + } else if ("connectionAuth".equals(fieldName)) { + deserializedDbmEndpoint.connectionAuth = ConnectionAuth.fromString(reader.getString()); + } else if ("port".equals(fieldName)) { + deserializedDbmEndpoint.port = reader.getNullable(JsonReader::getInt); + } else if ("isDynamicPort".equals(fieldName)) { + deserializedDbmEndpoint.isDynamicPort = reader.getNullable(JsonReader::getBoolean); + } else if ("ipAddress".equals(fieldName)) { + deserializedDbmEndpoint.ipAddress = reader.getString(); + } else if ("certificateName".equals(fieldName)) { + deserializedDbmEndpoint.certificateName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDbmEndpoint; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DefenderStatus.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DefenderStatus.java index 0eabfde8e3a7..d7f91af26969 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DefenderStatus.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DefenderStatus.java @@ -5,23 +5,30 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Status of Azure Defender. */ +/** + * Status of Azure Defender. + */ public final class DefenderStatus extends ExpandableStringEnum { - /** Static value Protected for DefenderStatus. */ + /** + * Static value Protected for DefenderStatus. + */ public static final DefenderStatus PROTECTED = fromString("Protected"); - /** Static value Unprotected for DefenderStatus. */ + /** + * Static value Unprotected for DefenderStatus. + */ public static final DefenderStatus UNPROTECTED = fromString("Unprotected"); - /** Static value Unknown for DefenderStatus. */ + /** + * Static value Unknown for DefenderStatus. + */ public static final DefenderStatus UNKNOWN = fromString("Unknown"); /** * Creates a new instance of DefenderStatus value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -30,18 +37,17 @@ public DefenderStatus() { /** * Creates or finds a DefenderStatus from its string representation. - * + * * @param name a name to look for. * @return the corresponding DefenderStatus. */ - @JsonCreator public static DefenderStatus fromString(String name) { return fromString(name, DefenderStatus.class); } /** * Gets known DefenderStatus values. - * + * * @return known DefenderStatus values. */ public static Collection values() { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DifferentialBackupHours.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DifferentialBackupHours.java new file mode 100644 index 000000000000..24506cf30204 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DifferentialBackupHours.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.azurearcdata.models; + +/** + * The differential backup interval in hours. + */ +public enum DifferentialBackupHours { + /** + * Enum value 12. + */ + ONE_TWO(12), + + /** + * Enum value 24. + */ + TWO_FOUR(24); + + /** + * The actual serialized value for a DifferentialBackupHours instance. + */ + private final int value; + + DifferentialBackupHours(int value) { + this.value = value; + } + + /** + * Parses a serialized value to a DifferentialBackupHours instance. + * + * @param value the serialized value to parse. + * @return the parsed DifferentialBackupHours object, or null if unable to parse. + */ + public static DifferentialBackupHours fromInt(int value) { + DifferentialBackupHours[] items = DifferentialBackupHours.values(); + for (DifferentialBackupHours item : items) { + if (item.toInt() == value) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to int value. + * + * @return the int value. + */ + public int toInt() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration.java new file mode 100644 index 000000000000..cf6b554c591f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The availability group certificate configuration. + */ +@Fluent +public final class DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration + implements JsonSerializable { + /* + * Name of the certificate. + */ + private String certificateName; + + /** + * Creates an instance of DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration class. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() { + } + + /** + * Get the certificateName property: Name of the certificate. + * + * @return the certificateName value. + */ + public String certificateName() { + return this.certificateName; + } + + /** + * Set the certificateName property: Name of the certificate. + * + * @param certificateName the certificateName value to set. + * @return the DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration + withCertificateName(String certificateName) { + this.certificateName = certificateName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("certificateName", this.certificateName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration from the + * JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration if the + * JsonReader was pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration. + */ + public static DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration + fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration + = new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("certificateName".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration.certificateName + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.java new file mode 100644 index 000000000000..51634dadd18b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The availability group configuration specification for a distributed availability group. + */ +@Fluent +public final class DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration + implements JsonSerializable { + /* + * The azure resource identifier for the availability group. + */ + private String availabilityGroup; + + /* + * The listener URL of the availability group. + */ + private String listenerUrl; + + /* + * The availability mode of the availability group. + */ + private ArcSqlServerAvailabilityMode availabilityMode; + + /* + * The failover mode of the availability group. + */ + private ArcSqlServerFailoverMode failoverMode; + + /* + * The seeding mode of the availability group. + */ + private SeedingMode seedingMode; + + /* + * The certificate configuration for the availability group. + */ + private DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration certificateConfiguration; + + /** + * Creates an instance of DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration class. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() { + } + + /** + * Get the availabilityGroup property: The azure resource identifier for the availability group. + * + * @return the availabilityGroup value. + */ + public String availabilityGroup() { + return this.availabilityGroup; + } + + /** + * Set the availabilityGroup property: The azure resource identifier for the availability group. + * + * @param availabilityGroup the availabilityGroup value to set. + * @return the DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration + withAvailabilityGroup(String availabilityGroup) { + this.availabilityGroup = availabilityGroup; + return this; + } + + /** + * Get the listenerUrl property: The listener URL of the availability group. + * + * @return the listenerUrl value. + */ + public String listenerUrl() { + return this.listenerUrl; + } + + /** + * Set the listenerUrl property: The listener URL of the availability group. + * + * @param listenerUrl the listenerUrl value to set. + * @return the DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration withListenerUrl(String listenerUrl) { + this.listenerUrl = listenerUrl; + return this; + } + + /** + * Get the availabilityMode property: The availability mode of the availability group. + * + * @return the availabilityMode value. + */ + public ArcSqlServerAvailabilityMode availabilityMode() { + return this.availabilityMode; + } + + /** + * Set the availabilityMode property: The availability mode of the availability group. + * + * @param availabilityMode the availabilityMode value to set. + * @return the DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration + withAvailabilityMode(ArcSqlServerAvailabilityMode availabilityMode) { + this.availabilityMode = availabilityMode; + return this; + } + + /** + * Get the failoverMode property: The failover mode of the availability group. + * + * @return the failoverMode value. + */ + public ArcSqlServerFailoverMode failoverMode() { + return this.failoverMode; + } + + /** + * Set the failoverMode property: The failover mode of the availability group. + * + * @param failoverMode the failoverMode value to set. + * @return the DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration + withFailoverMode(ArcSqlServerFailoverMode failoverMode) { + this.failoverMode = failoverMode; + return this; + } + + /** + * Get the seedingMode property: The seeding mode of the availability group. + * + * @return the seedingMode value. + */ + public SeedingMode seedingMode() { + return this.seedingMode; + } + + /** + * Set the seedingMode property: The seeding mode of the availability group. + * + * @param seedingMode the seedingMode value to set. + * @return the DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration + withSeedingMode(SeedingMode seedingMode) { + this.seedingMode = seedingMode; + return this; + } + + /** + * Get the certificateConfiguration property: The certificate configuration for the availability group. + * + * @return the certificateConfiguration value. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration + certificateConfiguration() { + return this.certificateConfiguration; + } + + /** + * Set the certificateConfiguration property: The certificate configuration for the availability group. + * + * @param certificateConfiguration the certificateConfiguration value to set. + * @return the DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration withCertificateConfiguration( + DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration certificateConfiguration) { + this.certificateConfiguration = certificateConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (certificateConfiguration() != null) { + certificateConfiguration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("availabilityGroup", this.availabilityGroup); + jsonWriter.writeStringField("listenerUrl", this.listenerUrl); + jsonWriter.writeStringField("availabilityMode", + this.availabilityMode == null ? null : this.availabilityMode.toString()); + jsonWriter.writeStringField("failoverMode", this.failoverMode == null ? null : this.failoverMode.toString()); + jsonWriter.writeStringField("seedingMode", this.seedingMode == null ? null : this.seedingMode.toString()); + jsonWriter.writeJsonField("certificateConfiguration", this.certificateConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration if the JsonReader + * was pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration. + */ + public static DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration + = new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("availabilityGroup".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.availabilityGroup + = reader.getString(); + } else if ("listenerUrl".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.listenerUrl + = reader.getString(); + } else if ("availabilityMode".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.availabilityMode + = ArcSqlServerAvailabilityMode.fromString(reader.getString()); + } else if ("failoverMode".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.failoverMode + = ArcSqlServerFailoverMode.fromString(reader.getString()); + } else if ("seedingMode".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.seedingMode + = SeedingMode.fromString(reader.getString()); + } else if ("certificateConfiguration".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.certificateConfiguration + = DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration + .fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateConfiguration.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateConfiguration.java new file mode 100644 index 000000000000..6cfbc07f55ef --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateConfiguration.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Options used in creating a distributed availability group. + */ +@Fluent +public final class DistributedAvailabilityGroupCreateUpdateConfiguration + implements JsonSerializable { + /* + * Name of the availability group. + */ + private String availabilityGroupName; + + /* + * The initial primary availability group for the distributed availability group. + */ + private DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration primaryAvailabilityGroup; + + /* + * The initial secondary availability group for the distributed availability group. + */ + private DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration secondaryAvailabilityGroup; + + /** + * Creates an instance of DistributedAvailabilityGroupCreateUpdateConfiguration class. + */ + public DistributedAvailabilityGroupCreateUpdateConfiguration() { + } + + /** + * Get the availabilityGroupName property: Name of the availability group. + * + * @return the availabilityGroupName value. + */ + public String availabilityGroupName() { + return this.availabilityGroupName; + } + + /** + * Set the availabilityGroupName property: Name of the availability group. + * + * @param availabilityGroupName the availabilityGroupName value to set. + * @return the DistributedAvailabilityGroupCreateUpdateConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateConfiguration + withAvailabilityGroupName(String availabilityGroupName) { + this.availabilityGroupName = availabilityGroupName; + return this; + } + + /** + * Get the primaryAvailabilityGroup property: The initial primary availability group for the distributed + * availability group. + * + * @return the primaryAvailabilityGroup value. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration primaryAvailabilityGroup() { + return this.primaryAvailabilityGroup; + } + + /** + * Set the primaryAvailabilityGroup property: The initial primary availability group for the distributed + * availability group. + * + * @param primaryAvailabilityGroup the primaryAvailabilityGroup value to set. + * @return the DistributedAvailabilityGroupCreateUpdateConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateConfiguration withPrimaryAvailabilityGroup( + DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration primaryAvailabilityGroup) { + this.primaryAvailabilityGroup = primaryAvailabilityGroup; + return this; + } + + /** + * Get the secondaryAvailabilityGroup property: The initial secondary availability group for the distributed + * availability group. + * + * @return the secondaryAvailabilityGroup value. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration secondaryAvailabilityGroup() { + return this.secondaryAvailabilityGroup; + } + + /** + * Set the secondaryAvailabilityGroup property: The initial secondary availability group for the distributed + * availability group. + * + * @param secondaryAvailabilityGroup the secondaryAvailabilityGroup value to set. + * @return the DistributedAvailabilityGroupCreateUpdateConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateConfiguration withSecondaryAvailabilityGroup( + DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration secondaryAvailabilityGroup) { + this.secondaryAvailabilityGroup = secondaryAvailabilityGroup; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (primaryAvailabilityGroup() != null) { + primaryAvailabilityGroup().validate(); + } + if (secondaryAvailabilityGroup() != null) { + secondaryAvailabilityGroup().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("availabilityGroupName", this.availabilityGroupName); + jsonWriter.writeJsonField("primaryAvailabilityGroup", this.primaryAvailabilityGroup); + jsonWriter.writeJsonField("secondaryAvailabilityGroup", this.secondaryAvailabilityGroup); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DistributedAvailabilityGroupCreateUpdateConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DistributedAvailabilityGroupCreateUpdateConfiguration if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DistributedAvailabilityGroupCreateUpdateConfiguration. + */ + public static DistributedAvailabilityGroupCreateUpdateConfiguration fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DistributedAvailabilityGroupCreateUpdateConfiguration deserializedDistributedAvailabilityGroupCreateUpdateConfiguration + = new DistributedAvailabilityGroupCreateUpdateConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("availabilityGroupName".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateConfiguration.availabilityGroupName + = reader.getString(); + } else if ("primaryAvailabilityGroup".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateConfiguration.primaryAvailabilityGroup + = DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.fromJson(reader); + } else if ("secondaryAvailabilityGroup".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateConfiguration.secondaryAvailabilityGroup + = DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDistributedAvailabilityGroupCreateUpdateConfiguration; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DtcSupport.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DtcSupport.java new file mode 100644 index 000000000000..e734664ff95a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DtcSupport.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * Specifies whether DTC support has been enabled for this availability group. + */ +public enum DtcSupport { + /** + * Enum value PER_DB. + */ + PER_DB("PER_DB"), + + /** + * Enum value NONE. + */ + NONE("NONE"); + + /** + * The actual serialized value for a DtcSupport instance. + */ + private final String value; + + DtcSupport(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DtcSupport instance. + * + * @param value the serialized value to parse. + * @return the parsed DtcSupport object, or null if unable to parse. + */ + public static DtcSupport fromString(String value) { + if (value == null) { + return null; + } + DtcSupport[] items = DtcSupport.values(); + for (DtcSupport item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EditionType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EditionType.java index fa05fa3f67f8..d7a8f6b0cbb5 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EditionType.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EditionType.java @@ -5,32 +5,50 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** SQL Server edition. */ +/** + * SQL Server edition. + */ public final class EditionType extends ExpandableStringEnum { - /** Static value Evaluation for EditionType. */ + /** + * Static value Evaluation for EditionType. + */ public static final EditionType EVALUATION = fromString("Evaluation"); - /** Static value Enterprise for EditionType. */ + /** + * Static value Enterprise for EditionType. + */ public static final EditionType ENTERPRISE = fromString("Enterprise"); - /** Static value Standard for EditionType. */ + /** + * Static value Standard for EditionType. + */ public static final EditionType STANDARD = fromString("Standard"); - /** Static value Web for EditionType. */ + /** + * Static value Web for EditionType. + */ public static final EditionType WEB = fromString("Web"); - /** Static value Developer for EditionType. */ + /** + * Static value Developer for EditionType. + */ public static final EditionType DEVELOPER = fromString("Developer"); - /** Static value Express for EditionType. */ + /** + * Static value Express for EditionType. + */ public static final EditionType EXPRESS = fromString("Express"); + /** + * Static value Business Intelligence for EditionType. + */ + public static final EditionType BUSINESS_INTELLIGENCE = fromString("Business Intelligence"); + /** * Creates a new instance of EditionType value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -39,18 +57,17 @@ public EditionType() { /** * Creates or finds a EditionType from its string representation. - * + * * @param name a name to look for. * @return the corresponding EditionType. */ - @JsonCreator public static EditionType fromString(String name) { return fromString(name, EditionType.class); } /** * Gets known EditionType values. - * + * * @return known EditionType values. */ public static Collection values() { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EncryptionAlgorithm.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EncryptionAlgorithm.java new file mode 100644 index 000000000000..499acf5383ea --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EncryptionAlgorithm.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The encryption algorithm(s) used by the endpoint. + */ +public final class EncryptionAlgorithm extends ExpandableStringEnum { + /** + * Static value NONE for EncryptionAlgorithm. + */ + public static final EncryptionAlgorithm NONE = fromString("NONE"); + + /** + * Static value RC4 for EncryptionAlgorithm. + */ + public static final EncryptionAlgorithm RC4 = fromString("RC4"); + + /** + * Static value AES for EncryptionAlgorithm. + */ + public static final EncryptionAlgorithm AES = fromString("AES"); + + /** + * Static value NONE, RC4 for EncryptionAlgorithm. + */ + public static final EncryptionAlgorithm NONE_RC4 = fromString("NONE, RC4"); + + /** + * Static value NONE, AES for EncryptionAlgorithm. + */ + public static final EncryptionAlgorithm NONE_AES = fromString("NONE, AES"); + + /** + * Static value RC4, AES for EncryptionAlgorithm. + */ + public static final EncryptionAlgorithm RC4_AES = fromString("RC4, AES"); + + /** + * Static value AES, RC4 for EncryptionAlgorithm. + */ + public static final EncryptionAlgorithm AES_RC4 = fromString("AES, RC4"); + + /** + * Static value NONE, RC4, AES for EncryptionAlgorithm. + */ + public static final EncryptionAlgorithm NONE_RC4_AES = fromString("NONE, RC4, AES"); + + /** + * Static value NONE, AES, RC4 for EncryptionAlgorithm. + */ + public static final EncryptionAlgorithm NONE_AES_RC4 = fromString("NONE, AES, RC4"); + + /** + * Creates a new instance of EncryptionAlgorithm value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EncryptionAlgorithm() { + } + + /** + * Creates or finds a EncryptionAlgorithm from its string representation. + * + * @param name a name to look for. + * @return the corresponding EncryptionAlgorithm. + */ + public static EncryptionAlgorithm fromString(String name) { + return fromString(name, EncryptionAlgorithm.class); + } + + /** + * Gets known EncryptionAlgorithm values. + * + * @return known EncryptionAlgorithm values. + */ + public static Collection values() { + return values(EncryptionAlgorithm.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExecutionState.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExecutionState.java new file mode 100644 index 000000000000..90e03641d49f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExecutionState.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.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The execution state of the background job. + */ +public final class ExecutionState extends ExpandableStringEnum { + /** + * Static value Waiting for ExecutionState. + */ + public static final ExecutionState WAITING = fromString("Waiting"); + + /** + * Static value Running for ExecutionState. + */ + public static final ExecutionState RUNNING = fromString("Running"); + + /** + * Creates a new instance of ExecutionState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ExecutionState() { + } + + /** + * Creates or finds a ExecutionState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExecutionState. + */ + public static ExecutionState fromString(String name) { + return fromString(name, ExecutionState.class); + } + + /** + * Gets known ExecutionState values. + * + * @return known ExecutionState values. + */ + public static Collection values() { + return values(ExecutionState.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocation.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocation.java index 273f847667e9..42efd9ebe39f 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocation.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocation.java @@ -5,30 +5,36 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** The complex type of the extended location. */ +/** + * The complex type of the extended location. + */ @Fluent -public final class ExtendedLocation { +public final class ExtendedLocation implements JsonSerializable { /* * The name of the extended location. */ - @JsonProperty(value = "name") private String name; /* * The type of the extended location. */ - @JsonProperty(value = "type") private ExtendedLocationTypes type; - /** Creates an instance of ExtendedLocation class. */ + /** + * Creates an instance of ExtendedLocation class. + */ public ExtendedLocation() { } /** * Get the name property: The name of the extended location. - * + * * @return the name value. */ public String name() { @@ -37,7 +43,7 @@ public String name() { /** * Set the name property: The name of the extended location. - * + * * @param name the name value to set. * @return the ExtendedLocation object itself. */ @@ -48,7 +54,7 @@ public ExtendedLocation withName(String name) { /** * Get the type property: The type of the extended location. - * + * * @return the type value. */ public ExtendedLocationTypes type() { @@ -57,7 +63,7 @@ public ExtendedLocationTypes type() { /** * Set the type property: The type of the extended location. - * + * * @param type the type value to set. * @return the ExtendedLocation object itself. */ @@ -68,9 +74,48 @@ public ExtendedLocation withType(ExtendedLocationTypes type) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtendedLocation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtendedLocation if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ExtendedLocation. + */ + public static ExtendedLocation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExtendedLocation deserializedExtendedLocation = new ExtendedLocation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedExtendedLocation.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedExtendedLocation.type = ExtendedLocationTypes.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedExtendedLocation; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocationTypes.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocationTypes.java index d69d63869cb1..40dd7f500d72 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocationTypes.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocationTypes.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** The type of extendedLocation. */ +/** + * The type of extendedLocation. + */ public final class ExtendedLocationTypes extends ExpandableStringEnum { - /** Static value CustomLocation for ExtendedLocationTypes. */ + /** + * Static value CustomLocation for ExtendedLocationTypes. + */ public static final ExtendedLocationTypes CUSTOM_LOCATION = fromString("CustomLocation"); /** * Creates a new instance of ExtendedLocationTypes value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -24,18 +27,17 @@ public ExtendedLocationTypes() { /** * Creates or finds a ExtendedLocationTypes from its string representation. - * + * * @param name a name to look for. * @return the corresponding ExtendedLocationTypes. */ - @JsonCreator public static ExtendedLocationTypes fromString(String name) { return fromString(name, ExtendedLocationTypes.class); } /** * Gets known ExtendedLocationTypes values. - * + * * @return known ExtendedLocationTypes values. */ public static Collection values() { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverCluster.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverCluster.java new file mode 100644 index 000000000000..086e1d61c05e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverCluster.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.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Failover Cluster Instance properties. + */ +@Immutable +public final class FailoverCluster implements JsonSerializable { + /* + * The GUID of the SQL Server's underlying Failover Cluster. + */ + private String id; + + /* + * The network name to connect to the SQL FCI. + */ + private String networkName; + + /* + * The ARM IDs of the Arc SQL Server resources, belonging to the current server's Failover cluster. + */ + private List sqlInstanceIds; + + /* + * The host names which are part of the SQL FCI resource group. + */ + private List hostNames; + + /** + * Creates an instance of FailoverCluster class. + */ + public FailoverCluster() { + } + + /** + * Get the id property: The GUID of the SQL Server's underlying Failover Cluster. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the networkName property: The network name to connect to the SQL FCI. + * + * @return the networkName value. + */ + public String networkName() { + return this.networkName; + } + + /** + * Get the sqlInstanceIds property: The ARM IDs of the Arc SQL Server resources, belonging to the current server's + * Failover cluster. + * + * @return the sqlInstanceIds value. + */ + public List sqlInstanceIds() { + return this.sqlInstanceIds; + } + + /** + * Get the hostNames property: The host names which are part of the SQL FCI resource group. + * + * @return the hostNames value. + */ + public List hostNames() { + return this.hostNames; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FailoverCluster from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FailoverCluster if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the FailoverCluster. + */ + public static FailoverCluster fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FailoverCluster deserializedFailoverCluster = new FailoverCluster(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFailoverCluster.id = reader.getString(); + } else if ("networkName".equals(fieldName)) { + deserializedFailoverCluster.networkName = reader.getString(); + } else if ("sqlInstanceIds".equals(fieldName)) { + List sqlInstanceIds = reader.readArray(reader1 -> reader1.getString()); + deserializedFailoverCluster.sqlInstanceIds = sqlInstanceIds; + } else if ("hostNames".equals(fieldName)) { + List hostNames = reader.readArray(reader1 -> reader1.getString()); + deserializedFailoverCluster.hostNames = hostNames; + } else { + reader.skipChildren(); + } + } + + return deserializedFailoverCluster; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupListResult.java new file mode 100644 index 000000000000..6d3ede00e1a4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupListResult.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.fluent.models.FailoverGroupResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of failover groups. + */ +@Immutable +public final class FailoverGroupListResult implements JsonSerializable { + /* + * Array of failover group results. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of FailoverGroupListResult class. + */ + public FailoverGroupListResult() { + } + + /** + * Get the value property: Array of failover group results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FailoverGroupListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FailoverGroupListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the FailoverGroupListResult. + */ + public static FailoverGroupListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FailoverGroupListResult deserializedFailoverGroupListResult = new FailoverGroupListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> FailoverGroupResourceInner.fromJson(reader1)); + deserializedFailoverGroupListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedFailoverGroupListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFailoverGroupListResult; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupPartnerSyncMode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupPartnerSyncMode.java new file mode 100644 index 000000000000..bc79822e773f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupPartnerSyncMode.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.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The partner sync mode of the SQL managed instance. + */ +public final class FailoverGroupPartnerSyncMode extends ExpandableStringEnum { + /** + * Static value async for FailoverGroupPartnerSyncMode. + */ + public static final FailoverGroupPartnerSyncMode ASYNC = fromString("async"); + + /** + * Static value sync for FailoverGroupPartnerSyncMode. + */ + public static final FailoverGroupPartnerSyncMode SYNC = fromString("sync"); + + /** + * Creates a new instance of FailoverGroupPartnerSyncMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FailoverGroupPartnerSyncMode() { + } + + /** + * Creates or finds a FailoverGroupPartnerSyncMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding FailoverGroupPartnerSyncMode. + */ + public static FailoverGroupPartnerSyncMode fromString(String name) { + return fromString(name, FailoverGroupPartnerSyncMode.class); + } + + /** + * Gets known FailoverGroupPartnerSyncMode values. + * + * @return known FailoverGroupPartnerSyncMode values. + */ + public static Collection values() { + return values(FailoverGroupPartnerSyncMode.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupProperties.java new file mode 100644 index 000000000000..ee4888872d1e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupProperties.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The properties of a failover group resource. + */ +@Fluent +public final class FailoverGroupProperties implements JsonSerializable { + /* + * The provisioning state of the failover group resource. + */ + private ProvisioningState provisioningState; + + /* + * The resource ID of the partner SQL managed instance. + */ + private String partnerManagedInstanceId; + + /* + * The specifications of the failover group resource. + */ + private FailoverGroupSpec spec; + + /* + * The status of the failover group custom resource. + */ + private Object status; + + /* + * The properties of a failover group resource. + */ + private Map additionalProperties; + + /** + * Creates an instance of FailoverGroupProperties class. + */ + public FailoverGroupProperties() { + } + + /** + * Get the provisioningState property: The provisioning state of the failover group resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the partnerManagedInstanceId property: The resource ID of the partner SQL managed instance. + * + * @return the partnerManagedInstanceId value. + */ + public String partnerManagedInstanceId() { + return this.partnerManagedInstanceId; + } + + /** + * Set the partnerManagedInstanceId property: The resource ID of the partner SQL managed instance. + * + * @param partnerManagedInstanceId the partnerManagedInstanceId value to set. + * @return the FailoverGroupProperties object itself. + */ + public FailoverGroupProperties withPartnerManagedInstanceId(String partnerManagedInstanceId) { + this.partnerManagedInstanceId = partnerManagedInstanceId; + return this; + } + + /** + * Get the spec property: The specifications of the failover group resource. + * + * @return the spec value. + */ + public FailoverGroupSpec spec() { + return this.spec; + } + + /** + * Set the spec property: The specifications of the failover group resource. + * + * @param spec the spec value to set. + * @return the FailoverGroupProperties object itself. + */ + public FailoverGroupProperties withSpec(FailoverGroupSpec spec) { + this.spec = spec; + return this; + } + + /** + * Get the status property: The status of the failover group custom resource. + * + * @return the status value. + */ + public Object status() { + return this.status; + } + + /** + * Set the status property: The status of the failover group custom resource. + * + * @param status the status value to set. + * @return the FailoverGroupProperties object itself. + */ + public FailoverGroupProperties withStatus(Object status) { + this.status = status; + return this; + } + + /** + * Get the additionalProperties property: The properties of a failover group resource. + * + * @return the additionalProperties value. + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The properties of a failover group resource. + * + * @param additionalProperties the additionalProperties value to set. + * @return the FailoverGroupProperties object itself. + */ + public FailoverGroupProperties withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (partnerManagedInstanceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property partnerManagedInstanceId in model FailoverGroupProperties")); + } + if (spec() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property spec in model FailoverGroupProperties")); + } else { + spec().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FailoverGroupProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("partnerManagedInstanceId", this.partnerManagedInstanceId); + jsonWriter.writeJsonField("spec", this.spec); + jsonWriter.writeUntypedField("status", this.status); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FailoverGroupProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FailoverGroupProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FailoverGroupProperties. + */ + public static FailoverGroupProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FailoverGroupProperties deserializedFailoverGroupProperties = new FailoverGroupProperties(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("partnerManagedInstanceId".equals(fieldName)) { + deserializedFailoverGroupProperties.partnerManagedInstanceId = reader.getString(); + } else if ("spec".equals(fieldName)) { + deserializedFailoverGroupProperties.spec = FailoverGroupSpec.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedFailoverGroupProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedFailoverGroupProperties.status = reader.readUntyped(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedFailoverGroupProperties.additionalProperties = additionalProperties; + + return deserializedFailoverGroupProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupResource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupResource.java new file mode 100644 index 000000000000..8460d6fc4044 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupResource.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.FailoverGroupResourceInner; + +/** + * An immutable client-side representation of FailoverGroupResource. + */ +public interface FailoverGroupResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: null. + * + * @return the properties value. + */ + FailoverGroupProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.azurearcdata.fluent.models.FailoverGroupResourceInner object. + * + * @return the inner object. + */ + FailoverGroupResourceInner innerModel(); + + /** + * The entirety of the FailoverGroupResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, + DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * The FailoverGroupResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the FailoverGroupResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the FailoverGroupResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, sqlManagedInstanceName. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @return the next definition stage. + */ + WithProperties withExistingSqlManagedInstance(String resourceGroupName, String sqlManagedInstanceName); + } + + /** + * The stage of the FailoverGroupResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: null. + * + * @param properties null. + * @return the next definition stage. + */ + WithCreate withProperties(FailoverGroupProperties properties); + } + + /** + * The stage of the FailoverGroupResource 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. + */ + FailoverGroupResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FailoverGroupResource create(Context context); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FailoverGroupResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FailoverGroupResource refresh(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupSpec.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupSpec.java new file mode 100644 index 000000000000..67d6a293f56c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupSpec.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.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The specifications of the failover group resource. + */ +@Fluent +public final class FailoverGroupSpec implements JsonSerializable { + /* + * The shared name of the failover group for this SQL managed instance. Both SQL managed instance and its partner + * have to use the same shared name. + */ + private String sharedName; + + /* + * The name of the SQL managed instance with this failover group role. + */ + private String sourceMI; + + /* + * The name of the partner SQL managed instance. + */ + private String partnerMI; + + /* + * The mirroring endpoint URL of the partner SQL managed instance. + */ + private String partnerMirroringUrl; + + /* + * The mirroring endpoint public certificate for the partner SQL managed instance. Only PEM format is supported. + */ + private String partnerMirroringCert; + + /* + * The partner sync mode of the SQL managed instance. + */ + private FailoverGroupPartnerSyncMode partnerSyncMode; + + /* + * The role of the SQL managed instance in this failover group. + */ + private InstanceFailoverGroupRole role; + + /* + * The specifications of the failover group resource. + */ + private Map additionalProperties; + + /** + * Creates an instance of FailoverGroupSpec class. + */ + public FailoverGroupSpec() { + } + + /** + * Get the sharedName property: The shared name of the failover group for this SQL managed instance. Both SQL + * managed instance and its partner have to use the same shared name. + * + * @return the sharedName value. + */ + public String sharedName() { + return this.sharedName; + } + + /** + * Set the sharedName property: The shared name of the failover group for this SQL managed instance. Both SQL + * managed instance and its partner have to use the same shared name. + * + * @param sharedName the sharedName value to set. + * @return the FailoverGroupSpec object itself. + */ + public FailoverGroupSpec withSharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * Get the sourceMI property: The name of the SQL managed instance with this failover group role. + * + * @return the sourceMI value. + */ + public String sourceMI() { + return this.sourceMI; + } + + /** + * Set the sourceMI property: The name of the SQL managed instance with this failover group role. + * + * @param sourceMI the sourceMI value to set. + * @return the FailoverGroupSpec object itself. + */ + public FailoverGroupSpec withSourceMI(String sourceMI) { + this.sourceMI = sourceMI; + return this; + } + + /** + * Get the partnerMI property: The name of the partner SQL managed instance. + * + * @return the partnerMI value. + */ + public String partnerMI() { + return this.partnerMI; + } + + /** + * Set the partnerMI property: The name of the partner SQL managed instance. + * + * @param partnerMI the partnerMI value to set. + * @return the FailoverGroupSpec object itself. + */ + public FailoverGroupSpec withPartnerMI(String partnerMI) { + this.partnerMI = partnerMI; + return this; + } + + /** + * Get the partnerMirroringUrl property: The mirroring endpoint URL of the partner SQL managed instance. + * + * @return the partnerMirroringUrl value. + */ + public String partnerMirroringUrl() { + return this.partnerMirroringUrl; + } + + /** + * Set the partnerMirroringUrl property: The mirroring endpoint URL of the partner SQL managed instance. + * + * @param partnerMirroringUrl the partnerMirroringUrl value to set. + * @return the FailoverGroupSpec object itself. + */ + public FailoverGroupSpec withPartnerMirroringUrl(String partnerMirroringUrl) { + this.partnerMirroringUrl = partnerMirroringUrl; + return this; + } + + /** + * Get the partnerMirroringCert property: The mirroring endpoint public certificate for the partner SQL managed + * instance. Only PEM format is supported. + * + * @return the partnerMirroringCert value. + */ + public String partnerMirroringCert() { + return this.partnerMirroringCert; + } + + /** + * Set the partnerMirroringCert property: The mirroring endpoint public certificate for the partner SQL managed + * instance. Only PEM format is supported. + * + * @param partnerMirroringCert the partnerMirroringCert value to set. + * @return the FailoverGroupSpec object itself. + */ + public FailoverGroupSpec withPartnerMirroringCert(String partnerMirroringCert) { + this.partnerMirroringCert = partnerMirroringCert; + return this; + } + + /** + * Get the partnerSyncMode property: The partner sync mode of the SQL managed instance. + * + * @return the partnerSyncMode value. + */ + public FailoverGroupPartnerSyncMode partnerSyncMode() { + return this.partnerSyncMode; + } + + /** + * Set the partnerSyncMode property: The partner sync mode of the SQL managed instance. + * + * @param partnerSyncMode the partnerSyncMode value to set. + * @return the FailoverGroupSpec object itself. + */ + public FailoverGroupSpec withPartnerSyncMode(FailoverGroupPartnerSyncMode partnerSyncMode) { + this.partnerSyncMode = partnerSyncMode; + return this; + } + + /** + * Get the role property: The role of the SQL managed instance in this failover group. + * + * @return the role value. + */ + public InstanceFailoverGroupRole role() { + return this.role; + } + + /** + * Set the role property: The role of the SQL managed instance in this failover group. + * + * @param role the role value to set. + * @return the FailoverGroupSpec object itself. + */ + public FailoverGroupSpec withRole(InstanceFailoverGroupRole role) { + this.role = role; + return this; + } + + /** + * Get the additionalProperties property: The specifications of the failover group resource. + * + * @return the additionalProperties value. + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The specifications of the failover group resource. + * + * @param additionalProperties the additionalProperties value to set. + * @return the FailoverGroupSpec object itself. + */ + public FailoverGroupSpec withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (role() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property role in model FailoverGroupSpec")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FailoverGroupSpec.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("role", this.role == null ? null : this.role.toString()); + jsonWriter.writeStringField("sharedName", this.sharedName); + jsonWriter.writeStringField("sourceMI", this.sourceMI); + jsonWriter.writeStringField("partnerMI", this.partnerMI); + jsonWriter.writeStringField("partnerMirroringURL", this.partnerMirroringUrl); + jsonWriter.writeStringField("partnerMirroringCert", this.partnerMirroringCert); + jsonWriter.writeStringField("partnerSyncMode", + this.partnerSyncMode == null ? null : this.partnerSyncMode.toString()); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FailoverGroupSpec from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FailoverGroupSpec if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FailoverGroupSpec. + */ + public static FailoverGroupSpec fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FailoverGroupSpec deserializedFailoverGroupSpec = new FailoverGroupSpec(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("role".equals(fieldName)) { + deserializedFailoverGroupSpec.role = InstanceFailoverGroupRole.fromString(reader.getString()); + } else if ("sharedName".equals(fieldName)) { + deserializedFailoverGroupSpec.sharedName = reader.getString(); + } else if ("sourceMI".equals(fieldName)) { + deserializedFailoverGroupSpec.sourceMI = reader.getString(); + } else if ("partnerMI".equals(fieldName)) { + deserializedFailoverGroupSpec.partnerMI = reader.getString(); + } else if ("partnerMirroringURL".equals(fieldName)) { + deserializedFailoverGroupSpec.partnerMirroringUrl = reader.getString(); + } else if ("partnerMirroringCert".equals(fieldName)) { + deserializedFailoverGroupSpec.partnerMirroringCert = reader.getString(); + } else if ("partnerSyncMode".equals(fieldName)) { + deserializedFailoverGroupSpec.partnerSyncMode + = FailoverGroupPartnerSyncMode.fromString(reader.getString()); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedFailoverGroupSpec.additionalProperties = additionalProperties; + + return deserializedFailoverGroupSpec; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroups.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroups.java new file mode 100644 index 000000000000..c160a70077db --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroups.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.azurearcdata.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 FailoverGroups. + */ +public interface FailoverGroups { + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String sqlManagedInstanceName); + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String sqlManagedInstanceName, Context context); + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName); + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, Context context); + + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, Context context); + + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource. + */ + FailoverGroupResource get(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName); + + /** + * Retrieves a failover group resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response}. + */ + FailoverGroupResource getById(String id); + + /** + * Retrieves a failover group resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a failover group resource. + * + * @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 failover group resource. + * + * @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 FailoverGroupResource resource. + * + * @param name resource name. + * @return the first stage of the new FailoverGroupResource definition. + */ + FailoverGroupResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailureConditionLevel.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailureConditionLevel.java new file mode 100644 index 000000000000..887bca609972 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailureConditionLevel.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * User-defined failure condition level under which an automatic failover must be triggered. + */ +public enum FailureConditionLevel { + /** + * Enum value 1. + */ + ONE(1), + + /** + * Enum value 2. + */ + TWO(2), + + /** + * Enum value 3. + */ + THREE(3), + + /** + * Enum value 4. + */ + FOUR(4), + + /** + * Enum value 5. + */ + FIVE(5); + + /** + * The actual serialized value for a FailureConditionLevel instance. + */ + private final int value; + + FailureConditionLevel(int value) { + this.value = value; + } + + /** + * Parses a serialized value to a FailureConditionLevel instance. + * + * @param value the serialized value to parse. + * @return the parsed FailureConditionLevel object, or null if unable to parse. + */ + public static FailureConditionLevel fromInt(int value) { + FailureConditionLevel[] items = FailureConditionLevel.values(); + for (FailureConditionLevel item : items) { + if (item.toInt() == value) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to int value. + * + * @return the int value. + */ + public int toInt() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/HostType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/HostType.java new file mode 100644 index 000000000000..5537bfb2f2fe --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/HostType.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.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of host for Azure Arc SQL Server. + */ +public final class HostType extends ExpandableStringEnum { + /** + * Static value Azure Virtual Machine for HostType. + */ + public static final HostType AZURE_VIRTUAL_MACHINE = fromString("Azure Virtual Machine"); + + /** + * Static value Azure VMWare Virtual Machine for HostType. + */ + public static final HostType AZURE_VMWARE_VIRTUAL_MACHINE = fromString("Azure VMWare Virtual Machine"); + + /** + * Static value Azure Kubernetes Service for HostType. + */ + public static final HostType AZURE_KUBERNETES_SERVICE = fromString("Azure Kubernetes Service"); + + /** + * Static value AWS VMWare Virtual Machine for HostType. + */ + public static final HostType AWS_VMWARE_VIRTUAL_MACHINE = fromString("AWS VMWare Virtual Machine"); + + /** + * Static value AWS Kubernetes Service for HostType. + */ + public static final HostType AWS_KUBERNETES_SERVICE = fromString("AWS Kubernetes Service"); + + /** + * Static value GCP VMWare Virtual Machine for HostType. + */ + public static final HostType GCP_VMWARE_VIRTUAL_MACHINE = fromString("GCP VMWare Virtual Machine"); + + /** + * Static value GCP Kubernetes Service for HostType. + */ + public static final HostType GCP_KUBERNETES_SERVICE = fromString("GCP Kubernetes Service"); + + /** + * Static value Container for HostType. + */ + public static final HostType CONTAINER = fromString("Container"); + + /** + * Static value Virtual Machine for HostType. + */ + public static final HostType VIRTUAL_MACHINE = fromString("Virtual Machine"); + + /** + * Static value Physical Server for HostType. + */ + public static final HostType PHYSICAL_SERVER = fromString("Physical Server"); + + /** + * Static value AWS Virtual Machine for HostType. + */ + public static final HostType AWS_VIRTUAL_MACHINE = fromString("AWS Virtual Machine"); + + /** + * Static value GCP Virtual Machine for HostType. + */ + public static final HostType GCP_VIRTUAL_MACHINE = fromString("GCP Virtual Machine"); + + /** + * Static value Other for HostType. + */ + public static final HostType OTHER = fromString("Other"); + + /** + * Creates a new instance of HostType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public HostType() { + } + + /** + * Creates or finds a HostType from its string representation. + * + * @param name a name to look for. + * @return the corresponding HostType. + */ + public static HostType fromString(String name) { + return fromString(name, HostType.class); + } + + /** + * Gets known HostType values. + * + * @return known HostType values. + */ + public static Collection values() { + return values(HostType.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Infrastructure.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Infrastructure.java index 802e09aee7b7..b40e8a40fde0 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Infrastructure.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Infrastructure.java @@ -4,30 +4,43 @@ package com.azure.resourcemanager.azurearcdata.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** The infrastructure the data controller is running on. */ +/** + * The infrastructure the data controller is running on. + */ public enum Infrastructure { - /** Enum value azure. */ + /** + * Enum value azure. + */ AZURE("azure"), - /** Enum value gcp. */ + /** + * Enum value gcp. + */ GCP("gcp"), - /** Enum value aws. */ + /** + * Enum value aws. + */ AWS("aws"), - /** Enum value alibaba. */ + /** + * Enum value alibaba. + */ ALIBABA("alibaba"), - /** Enum value onpremises. */ + /** + * Enum value onpremises. + */ ONPREMISES("onpremises"), - /** Enum value other. */ + /** + * Enum value other. + */ OTHER("other"); - /** The actual serialized value for a Infrastructure instance. */ + /** + * The actual serialized value for a Infrastructure instance. + */ private final String value; Infrastructure(String value) { @@ -36,11 +49,10 @@ public enum Infrastructure { /** * Parses a serialized value to a Infrastructure instance. - * + * * @param value the serialized value to parse. * @return the parsed Infrastructure object, or null if unable to parse. */ - @JsonCreator public static Infrastructure fromString(String value) { if (value == null) { return null; @@ -54,8 +66,9 @@ public static Infrastructure fromString(String value) { return null; } - /** {@inheritDoc} */ - @JsonValue + /** + * {@inheritDoc} + */ @Override public String toString() { return this.value; diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/InstanceFailoverGroupRole.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/InstanceFailoverGroupRole.java new file mode 100644 index 000000000000..8c55e45a58c2 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/InstanceFailoverGroupRole.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The role of the SQL managed instance in this failover group. + */ +public final class InstanceFailoverGroupRole extends ExpandableStringEnum { + /** + * Static value primary for InstanceFailoverGroupRole. + */ + public static final InstanceFailoverGroupRole PRIMARY = fromString("primary"); + + /** + * Static value secondary for InstanceFailoverGroupRole. + */ + public static final InstanceFailoverGroupRole SECONDARY = fromString("secondary"); + + /** + * Static value force-primary-allow-data-loss for InstanceFailoverGroupRole. + */ + public static final InstanceFailoverGroupRole FORCE_PRIMARY_ALLOW_DATA_LOSS + = fromString("force-primary-allow-data-loss"); + + /** + * Static value force-secondary for InstanceFailoverGroupRole. + */ + public static final InstanceFailoverGroupRole FORCE_SECONDARY = fromString("force-secondary"); + + /** + * Creates a new instance of InstanceFailoverGroupRole value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public InstanceFailoverGroupRole() { + } + + /** + * Creates or finds a InstanceFailoverGroupRole from its string representation. + * + * @param name a name to look for. + * @return the corresponding InstanceFailoverGroupRole. + */ + public static InstanceFailoverGroupRole fromString(String name) { + return fromString(name, InstanceFailoverGroupRole.class); + } + + /** + * Gets known InstanceFailoverGroupRole values. + * + * @return known InstanceFailoverGroupRole values. + */ + public static Collection values() { + return values(InstanceFailoverGroupRole.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/JobStatus.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/JobStatus.java new file mode 100644 index 000000000000..11e492c0be8a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/JobStatus.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of the job. + */ +public final class JobStatus extends ExpandableStringEnum { + /** + * Static value NotStarted for JobStatus. + */ + public static final JobStatus NOT_STARTED = fromString("NotStarted"); + + /** + * Static value InProgress for JobStatus. + */ + public static final JobStatus IN_PROGRESS = fromString("InProgress"); + + /** + * Static value Succeeded for JobStatus. + */ + public static final JobStatus SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for JobStatus. + */ + public static final JobStatus FAILED = fromString("Failed"); + + /** + * Creates a new instance of JobStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public JobStatus() { + } + + /** + * Creates or finds a JobStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding JobStatus. + */ + public static JobStatus fromString(String name) { + return fromString(name, JobStatus.class); + } + + /** + * Gets known JobStatus values. + * + * @return known JobStatus values. + */ + public static Collection values() { + return values(JobStatus.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectory.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectory.java new file mode 100644 index 000000000000..71e04ee8682c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectory.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The kubernetes active directory information. + */ +@Fluent +public final class K8SActiveDirectory implements JsonSerializable { + /* + * The connector property. + */ + private K8SActiveDirectoryConnector connector; + + /* + * Account name for AAD + */ + private String accountName; + + /* + * Keytab secret used to authenticate with Active Directory. + */ + private String keytabSecret; + + /* + * An array of encryption types + */ + private List encryptionTypes; + + /** + * Creates an instance of K8SActiveDirectory class. + */ + public K8SActiveDirectory() { + } + + /** + * Get the connector property: The connector property. + * + * @return the connector value. + */ + public K8SActiveDirectoryConnector connector() { + return this.connector; + } + + /** + * Set the connector property: The connector property. + * + * @param connector the connector value to set. + * @return the K8SActiveDirectory object itself. + */ + public K8SActiveDirectory withConnector(K8SActiveDirectoryConnector connector) { + this.connector = connector; + return this; + } + + /** + * Get the accountName property: Account name for AAD. + * + * @return the accountName value. + */ + public String accountName() { + return this.accountName; + } + + /** + * Set the accountName property: Account name for AAD. + * + * @param accountName the accountName value to set. + * @return the K8SActiveDirectory object itself. + */ + public K8SActiveDirectory withAccountName(String accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get the keytabSecret property: Keytab secret used to authenticate with Active Directory. + * + * @return the keytabSecret value. + */ + public String keytabSecret() { + return this.keytabSecret; + } + + /** + * Set the keytabSecret property: Keytab secret used to authenticate with Active Directory. + * + * @param keytabSecret the keytabSecret value to set. + * @return the K8SActiveDirectory object itself. + */ + public K8SActiveDirectory withKeytabSecret(String keytabSecret) { + this.keytabSecret = keytabSecret; + return this; + } + + /** + * Get the encryptionTypes property: An array of encryption types. + * + * @return the encryptionTypes value. + */ + public List encryptionTypes() { + return this.encryptionTypes; + } + + /** + * Set the encryptionTypes property: An array of encryption types. + * + * @param encryptionTypes the encryptionTypes value to set. + * @return the K8SActiveDirectory object itself. + */ + public K8SActiveDirectory withEncryptionTypes(List encryptionTypes) { + this.encryptionTypes = encryptionTypes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connector() != null) { + connector().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("connector", this.connector); + jsonWriter.writeStringField("accountName", this.accountName); + jsonWriter.writeStringField("keytabSecret", this.keytabSecret); + jsonWriter.writeArrayField("encryptionTypes", this.encryptionTypes, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of K8SActiveDirectory from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of K8SActiveDirectory if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the K8SActiveDirectory. + */ + public static K8SActiveDirectory fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + K8SActiveDirectory deserializedK8SActiveDirectory = new K8SActiveDirectory(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connector".equals(fieldName)) { + deserializedK8SActiveDirectory.connector = K8SActiveDirectoryConnector.fromJson(reader); + } else if ("accountName".equals(fieldName)) { + deserializedK8SActiveDirectory.accountName = reader.getString(); + } else if ("keytabSecret".equals(fieldName)) { + deserializedK8SActiveDirectory.keytabSecret = reader.getString(); + } else if ("encryptionTypes".equals(fieldName)) { + List encryptionTypes = reader.readArray(reader1 -> reader1.getString()); + deserializedK8SActiveDirectory.encryptionTypes = encryptionTypes; + } else { + reader.skipChildren(); + } + } + + return deserializedK8SActiveDirectory; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectoryConnector.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectoryConnector.java new file mode 100644 index 000000000000..02b8bc1f1a5b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectoryConnector.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.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The K8SActiveDirectoryConnector model. + */ +@Fluent +public final class K8SActiveDirectoryConnector implements JsonSerializable { + /* + * Name of the connector + */ + private String name; + + /* + * Name space of the connector + */ + private String namespace; + + /** + * Creates an instance of K8SActiveDirectoryConnector class. + */ + public K8SActiveDirectoryConnector() { + } + + /** + * Get the name property: Name of the connector. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the connector. + * + * @param name the name value to set. + * @return the K8SActiveDirectoryConnector object itself. + */ + public K8SActiveDirectoryConnector withName(String name) { + this.name = name; + return this; + } + + /** + * Get the namespace property: Name space of the connector. + * + * @return the namespace value. + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace property: Name space of the connector. + * + * @param namespace the namespace value to set. + * @return the K8SActiveDirectoryConnector object itself. + */ + public K8SActiveDirectoryConnector withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("namespace", this.namespace); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of K8SActiveDirectoryConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of K8SActiveDirectoryConnector if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the K8SActiveDirectoryConnector. + */ + public static K8SActiveDirectoryConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + K8SActiveDirectoryConnector deserializedK8SActiveDirectoryConnector = new K8SActiveDirectoryConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedK8SActiveDirectoryConnector.name = reader.getString(); + } else if ("namespace".equals(fieldName)) { + deserializedK8SActiveDirectoryConnector.namespace = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedK8SActiveDirectoryConnector; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SNetworkSettings.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SNetworkSettings.java new file mode 100644 index 000000000000..23e12e9c5d43 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SNetworkSettings.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The kubernetes network settings information. + */ +@Fluent +public final class K8SNetworkSettings implements JsonSerializable { + /* + * If 1, then SQL Server forces all connections to be encrypted. By default, this option is 0 + */ + private Integer forceencryption; + + /* + * Specifies which ciphers are allowed by SQL Server for TLS + */ + private String tlsciphers; + + /* + * A comma-separated list of which TLS protocols are allowed by SQL Server + */ + private String tlsprotocols; + + /** + * Creates an instance of K8SNetworkSettings class. + */ + public K8SNetworkSettings() { + } + + /** + * Get the forceencryption property: If 1, then SQL Server forces all connections to be encrypted. By default, this + * option is 0. + * + * @return the forceencryption value. + */ + public Integer forceencryption() { + return this.forceencryption; + } + + /** + * Set the forceencryption property: If 1, then SQL Server forces all connections to be encrypted. By default, this + * option is 0. + * + * @param forceencryption the forceencryption value to set. + * @return the K8SNetworkSettings object itself. + */ + public K8SNetworkSettings withForceencryption(Integer forceencryption) { + this.forceencryption = forceencryption; + return this; + } + + /** + * Get the tlsciphers property: Specifies which ciphers are allowed by SQL Server for TLS. + * + * @return the tlsciphers value. + */ + public String tlsciphers() { + return this.tlsciphers; + } + + /** + * Set the tlsciphers property: Specifies which ciphers are allowed by SQL Server for TLS. + * + * @param tlsciphers the tlsciphers value to set. + * @return the K8SNetworkSettings object itself. + */ + public K8SNetworkSettings withTlsciphers(String tlsciphers) { + this.tlsciphers = tlsciphers; + return this; + } + + /** + * Get the tlsprotocols property: A comma-separated list of which TLS protocols are allowed by SQL Server. + * + * @return the tlsprotocols value. + */ + public String tlsprotocols() { + return this.tlsprotocols; + } + + /** + * Set the tlsprotocols property: A comma-separated list of which TLS protocols are allowed by SQL Server. + * + * @param tlsprotocols the tlsprotocols value to set. + * @return the K8SNetworkSettings object itself. + */ + public K8SNetworkSettings withTlsprotocols(String tlsprotocols) { + this.tlsprotocols = tlsprotocols; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("forceencryption", this.forceencryption); + jsonWriter.writeStringField("tlsciphers", this.tlsciphers); + jsonWriter.writeStringField("tlsprotocols", this.tlsprotocols); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of K8SNetworkSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of K8SNetworkSettings if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the K8SNetworkSettings. + */ + public static K8SNetworkSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + K8SNetworkSettings deserializedK8SNetworkSettings = new K8SNetworkSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("forceencryption".equals(fieldName)) { + deserializedK8SNetworkSettings.forceencryption = reader.getNullable(JsonReader::getInt); + } else if ("tlsciphers".equals(fieldName)) { + deserializedK8SNetworkSettings.tlsciphers = reader.getString(); + } else if ("tlsprotocols".equals(fieldName)) { + deserializedK8SNetworkSettings.tlsprotocols = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedK8SNetworkSettings; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SResourceRequirements.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SResourceRequirements.java index 591b8dd608d8..23e525f4f2ca 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SResourceRequirements.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SResourceRequirements.java @@ -5,24 +5,24 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.HashMap; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; import java.util.Map; -/** The kubernetes resource limits and requests used to restrict or reserve resource usage. */ +/** + * The kubernetes resource limits and requests used to restrict or reserve resource usage. + */ @Fluent -public final class K8SResourceRequirements { +public final class K8SResourceRequirements implements JsonSerializable { /* * Requests for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' request must be less than or equal to * 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', minimum is '2Gi. If sku.tier is * GeneralPurpose, maximum 'cpu' is 24 and maximum 'memory' is '128Gi'. */ - @JsonProperty(value = "requests") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map requests; /* @@ -30,16 +30,16 @@ public final class K8SResourceRequirements { * 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', minimum is '2Gi. If sku.tier is * GeneralPurpose, maximum 'cpu' is 24 and maximum 'memory' is '128Gi'. */ - @JsonProperty(value = "limits") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map limits; /* * The kubernetes resource limits and requests used to restrict or reserve resource usage. */ - @JsonIgnore private Map additionalProperties; + private Map additionalProperties; - /** Creates an instance of K8SResourceRequirements class. */ + /** + * Creates an instance of K8SResourceRequirements class. + */ public K8SResourceRequirements() { } @@ -47,7 +47,7 @@ public K8SResourceRequirements() { * Get the requests property: Requests for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' request must * be less than or equal to 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', minimum is * '2Gi. If sku.tier is GeneralPurpose, maximum 'cpu' is 24 and maximum 'memory' is '128Gi'. - * + * * @return the requests value. */ public Map requests() { @@ -58,7 +58,7 @@ public Map requests() { * Set the requests property: Requests for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' request must * be less than or equal to 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', minimum is * '2Gi. If sku.tier is GeneralPurpose, maximum 'cpu' is 24 and maximum 'memory' is '128Gi'. - * + * * @param requests the requests value to set. * @return the K8SResourceRequirements object itself. */ @@ -71,7 +71,7 @@ public K8SResourceRequirements withRequests(Map requests) { * Get the limits property: Limits for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' request must be * less than or equal to 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', minimum is '2Gi. * If sku.tier is GeneralPurpose, maximum 'cpu' is 24 and maximum 'memory' is '128Gi'. - * + * * @return the limits value. */ public Map limits() { @@ -82,7 +82,7 @@ public Map limits() { * Set the limits property: Limits for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' request must be * less than or equal to 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', minimum is '2Gi. * If sku.tier is GeneralPurpose, maximum 'cpu' is 24 and maximum 'memory' is '128Gi'. - * + * * @param limits the limits value to set. * @return the K8SResourceRequirements object itself. */ @@ -94,10 +94,9 @@ public K8SResourceRequirements withLimits(Map limits) { /** * Get the additionalProperties property: The kubernetes resource limits and requests used to restrict or reserve * resource usage. - * + * * @return the additionalProperties value. */ - @JsonAnyGetter public Map additionalProperties() { return this.additionalProperties; } @@ -105,7 +104,7 @@ public Map additionalProperties() { /** * Set the additionalProperties property: The kubernetes resource limits and requests used to restrict or reserve * resource usage. - * + * * @param additionalProperties the additionalProperties value to set. * @return the K8SResourceRequirements object itself. */ @@ -114,19 +113,63 @@ public K8SResourceRequirements withAdditionalProperties(Map addi return this; } - @JsonAnySetter - void withAdditionalProperties(String key, Object value) { - if (additionalProperties == null) { - additionalProperties = new HashMap<>(); - } - additionalProperties.put(key, value); - } - /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("requests", this.requests, (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("limits", this.limits, (writer, element) -> writer.writeString(element)); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of K8SResourceRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of K8SResourceRequirements if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the K8SResourceRequirements. + */ + public static K8SResourceRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + K8SResourceRequirements deserializedK8SResourceRequirements = new K8SResourceRequirements(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requests".equals(fieldName)) { + Map requests = reader.readMap(reader1 -> reader1.getString()); + deserializedK8SResourceRequirements.requests = requests; + } else if ("limits".equals(fieldName)) { + Map limits = reader.readMap(reader1 -> reader1.getString()); + deserializedK8SResourceRequirements.limits = limits; + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedK8SResourceRequirements.additionalProperties = additionalProperties; + + return deserializedK8SResourceRequirements; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SScheduling.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SScheduling.java index dadc09db3502..efa5fa454adf 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SScheduling.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SScheduling.java @@ -5,36 +5,40 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.HashMap; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; import java.util.Map; -/** The kubernetes scheduling information. */ +/** + * The kubernetes scheduling information. + */ @Fluent -public final class K8SScheduling { +public final class K8SScheduling implements JsonSerializable { /* * The kubernetes scheduling options. It describes restrictions used to help Kubernetes select appropriate nodes to * host the database service */ - @JsonProperty(value = "default") private K8SSchedulingOptions defaultProperty; /* * The kubernetes scheduling information. */ - @JsonIgnore private Map additionalProperties; + private Map additionalProperties; - /** Creates an instance of K8SScheduling class. */ + /** + * Creates an instance of K8SScheduling class. + */ public K8SScheduling() { } /** * Get the defaultProperty property: The kubernetes scheduling options. It describes restrictions used to help * Kubernetes select appropriate nodes to host the database service. - * + * * @return the defaultProperty value. */ public K8SSchedulingOptions defaultProperty() { @@ -44,7 +48,7 @@ public K8SSchedulingOptions defaultProperty() { /** * Set the defaultProperty property: The kubernetes scheduling options. It describes restrictions used to help * Kubernetes select appropriate nodes to host the database service. - * + * * @param defaultProperty the defaultProperty value to set. * @return the K8SScheduling object itself. */ @@ -55,17 +59,16 @@ public K8SScheduling withDefaultProperty(K8SSchedulingOptions defaultProperty) { /** * Get the additionalProperties property: The kubernetes scheduling information. - * + * * @return the additionalProperties value. */ - @JsonAnyGetter public Map additionalProperties() { return this.additionalProperties; } /** * Set the additionalProperties property: The kubernetes scheduling information. - * + * * @param additionalProperties the additionalProperties value to set. * @return the K8SScheduling object itself. */ @@ -74,17 +77,9 @@ public K8SScheduling withAdditionalProperties(Map additionalProp return this; } - @JsonAnySetter - void withAdditionalProperties(String key, Object value) { - if (additionalProperties == null) { - additionalProperties = new HashMap<>(); - } - additionalProperties.put(key, value); - } - /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -92,4 +87,51 @@ public void validate() { defaultProperty().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("default", this.defaultProperty); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of K8SScheduling from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of K8SScheduling if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the K8SScheduling. + */ + public static K8SScheduling fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + K8SScheduling deserializedK8SScheduling = new K8SScheduling(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("default".equals(fieldName)) { + deserializedK8SScheduling.defaultProperty = K8SSchedulingOptions.fromJson(reader); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedK8SScheduling.additionalProperties = additionalProperties; + + return deserializedK8SScheduling; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSchedulingOptions.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSchedulingOptions.java index e8ad00b02966..9fe29b6175e8 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSchedulingOptions.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSchedulingOptions.java @@ -5,11 +5,12 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.HashMap; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; import java.util.Map; /** @@ -17,27 +18,28 @@ * the database service. */ @Fluent -public final class K8SSchedulingOptions { +public final class K8SSchedulingOptions implements JsonSerializable { /* * The kubernetes resource limits and requests used to restrict or reserve resource usage. */ - @JsonProperty(value = "resources") private K8SResourceRequirements resources; /* * The kubernetes scheduling options. It describes restrictions used to help Kubernetes select appropriate nodes to * host the database service */ - @JsonIgnore private Map additionalProperties; + private Map additionalProperties; - /** Creates an instance of K8SSchedulingOptions class. */ + /** + * Creates an instance of K8SSchedulingOptions class. + */ public K8SSchedulingOptions() { } /** * Get the resources property: The kubernetes resource limits and requests used to restrict or reserve resource * usage. - * + * * @return the resources value. */ public K8SResourceRequirements resources() { @@ -47,7 +49,7 @@ public K8SResourceRequirements resources() { /** * Set the resources property: The kubernetes resource limits and requests used to restrict or reserve resource * usage. - * + * * @param resources the resources value to set. * @return the K8SSchedulingOptions object itself. */ @@ -59,10 +61,9 @@ public K8SSchedulingOptions withResources(K8SResourceRequirements resources) { /** * Get the additionalProperties property: The kubernetes scheduling options. It describes restrictions used to help * Kubernetes select appropriate nodes to host the database service. - * + * * @return the additionalProperties value. */ - @JsonAnyGetter public Map additionalProperties() { return this.additionalProperties; } @@ -70,7 +71,7 @@ public Map additionalProperties() { /** * Set the additionalProperties property: The kubernetes scheduling options. It describes restrictions used to help * Kubernetes select appropriate nodes to host the database service. - * + * * @param additionalProperties the additionalProperties value to set. * @return the K8SSchedulingOptions object itself. */ @@ -79,17 +80,9 @@ public K8SSchedulingOptions withAdditionalProperties(Map additio return this; } - @JsonAnySetter - void withAdditionalProperties(String key, Object value) { - if (additionalProperties == null) { - additionalProperties = new HashMap<>(); - } - additionalProperties.put(key, value); - } - /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -97,4 +90,51 @@ public void validate() { resources().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resources", this.resources); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of K8SSchedulingOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of K8SSchedulingOptions if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the K8SSchedulingOptions. + */ + public static K8SSchedulingOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + K8SSchedulingOptions deserializedK8SSchedulingOptions = new K8SSchedulingOptions(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resources".equals(fieldName)) { + deserializedK8SSchedulingOptions.resources = K8SResourceRequirements.fromJson(reader); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedK8SSchedulingOptions.additionalProperties = additionalProperties; + + return deserializedK8SSchedulingOptions; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSecurity.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSecurity.java new file mode 100644 index 000000000000..a47f1f52af99 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSecurity.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The kubernetes security information. + */ +@Fluent +public final class K8SSecurity implements JsonSerializable { + /* + * Admin login secret key + */ + private String adminLoginSecret; + + /* + * Service certificate secret used + */ + private String serviceCertificateSecret; + + /* + * The kubernetes active directory information. + */ + private K8SActiveDirectory activeDirectory; + + /* + * Transparent data encryption information. + */ + private K8StransparentDataEncryption transparentDataEncryption; + + /* + * The kubernetes security information. + */ + private Map additionalProperties; + + /** + * Creates an instance of K8SSecurity class. + */ + public K8SSecurity() { + } + + /** + * Get the adminLoginSecret property: Admin login secret key. + * + * @return the adminLoginSecret value. + */ + public String adminLoginSecret() { + return this.adminLoginSecret; + } + + /** + * Set the adminLoginSecret property: Admin login secret key. + * + * @param adminLoginSecret the adminLoginSecret value to set. + * @return the K8SSecurity object itself. + */ + public K8SSecurity withAdminLoginSecret(String adminLoginSecret) { + this.adminLoginSecret = adminLoginSecret; + return this; + } + + /** + * Get the serviceCertificateSecret property: Service certificate secret used. + * + * @return the serviceCertificateSecret value. + */ + public String serviceCertificateSecret() { + return this.serviceCertificateSecret; + } + + /** + * Set the serviceCertificateSecret property: Service certificate secret used. + * + * @param serviceCertificateSecret the serviceCertificateSecret value to set. + * @return the K8SSecurity object itself. + */ + public K8SSecurity withServiceCertificateSecret(String serviceCertificateSecret) { + this.serviceCertificateSecret = serviceCertificateSecret; + return this; + } + + /** + * Get the activeDirectory property: The kubernetes active directory information. + * + * @return the activeDirectory value. + */ + public K8SActiveDirectory activeDirectory() { + return this.activeDirectory; + } + + /** + * Set the activeDirectory property: The kubernetes active directory information. + * + * @param activeDirectory the activeDirectory value to set. + * @return the K8SSecurity object itself. + */ + public K8SSecurity withActiveDirectory(K8SActiveDirectory activeDirectory) { + this.activeDirectory = activeDirectory; + return this; + } + + /** + * Get the transparentDataEncryption property: Transparent data encryption information. + * + * @return the transparentDataEncryption value. + */ + public K8StransparentDataEncryption transparentDataEncryption() { + return this.transparentDataEncryption; + } + + /** + * Set the transparentDataEncryption property: Transparent data encryption information. + * + * @param transparentDataEncryption the transparentDataEncryption value to set. + * @return the K8SSecurity object itself. + */ + public K8SSecurity withTransparentDataEncryption(K8StransparentDataEncryption transparentDataEncryption) { + this.transparentDataEncryption = transparentDataEncryption; + return this; + } + + /** + * Get the additionalProperties property: The kubernetes security information. + * + * @return the additionalProperties value. + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The kubernetes security information. + * + * @param additionalProperties the additionalProperties value to set. + * @return the K8SSecurity object itself. + */ + public K8SSecurity withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (activeDirectory() != null) { + activeDirectory().validate(); + } + if (transparentDataEncryption() != null) { + transparentDataEncryption().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("adminLoginSecret", this.adminLoginSecret); + jsonWriter.writeStringField("serviceCertificateSecret", this.serviceCertificateSecret); + jsonWriter.writeJsonField("activeDirectory", this.activeDirectory); + jsonWriter.writeJsonField("transparentDataEncryption", this.transparentDataEncryption); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of K8SSecurity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of K8SSecurity if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the K8SSecurity. + */ + public static K8SSecurity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + K8SSecurity deserializedK8SSecurity = new K8SSecurity(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("adminLoginSecret".equals(fieldName)) { + deserializedK8SSecurity.adminLoginSecret = reader.getString(); + } else if ("serviceCertificateSecret".equals(fieldName)) { + deserializedK8SSecurity.serviceCertificateSecret = reader.getString(); + } else if ("activeDirectory".equals(fieldName)) { + deserializedK8SSecurity.activeDirectory = K8SActiveDirectory.fromJson(reader); + } else if ("transparentDataEncryption".equals(fieldName)) { + deserializedK8SSecurity.transparentDataEncryption = K8StransparentDataEncryption.fromJson(reader); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedK8SSecurity.additionalProperties = additionalProperties; + + return deserializedK8SSecurity; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSettings.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSettings.java new file mode 100644 index 000000000000..9d5f3f2af26d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSettings.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The kubernetes settings information. + */ +@Fluent +public final class K8SSettings implements JsonSerializable { + /* + * The kubernetes network settings information. + */ + private K8SNetworkSettings network; + + /* + * The kubernetes settings information. + */ + private Map additionalProperties; + + /** + * Creates an instance of K8SSettings class. + */ + public K8SSettings() { + } + + /** + * Get the network property: The kubernetes network settings information. + * + * @return the network value. + */ + public K8SNetworkSettings network() { + return this.network; + } + + /** + * Set the network property: The kubernetes network settings information. + * + * @param network the network value to set. + * @return the K8SSettings object itself. + */ + public K8SSettings withNetwork(K8SNetworkSettings network) { + this.network = network; + return this; + } + + /** + * Get the additionalProperties property: The kubernetes settings information. + * + * @return the additionalProperties value. + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The kubernetes settings information. + * + * @param additionalProperties the additionalProperties value to set. + * @return the K8SSettings object itself. + */ + public K8SSettings withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (network() != null) { + network().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("network", this.network); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of K8SSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of K8SSettings if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the K8SSettings. + */ + public static K8SSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + K8SSettings deserializedK8SSettings = new K8SSettings(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("network".equals(fieldName)) { + deserializedK8SSettings.network = K8SNetworkSettings.fromJson(reader); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedK8SSettings.additionalProperties = additionalProperties; + + return deserializedK8SSettings; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8StransparentDataEncryption.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8StransparentDataEncryption.java new file mode 100644 index 000000000000..caa901a490d6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8StransparentDataEncryption.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.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Transparent data encryption information. + */ +@Fluent +public final class K8StransparentDataEncryption implements JsonSerializable { + /* + * Transparent data encryption mode. Can be Service Managed, Customer managed or disabled + */ + private String mode; + + /* + * Protector secret for customer managed Transparent data encryption mode + */ + private String protectorSecret; + + /** + * Creates an instance of K8StransparentDataEncryption class. + */ + public K8StransparentDataEncryption() { + } + + /** + * Get the mode property: Transparent data encryption mode. Can be Service Managed, Customer managed or disabled. + * + * @return the mode value. + */ + public String mode() { + return this.mode; + } + + /** + * Set the mode property: Transparent data encryption mode. Can be Service Managed, Customer managed or disabled. + * + * @param mode the mode value to set. + * @return the K8StransparentDataEncryption object itself. + */ + public K8StransparentDataEncryption withMode(String mode) { + this.mode = mode; + return this; + } + + /** + * Get the protectorSecret property: Protector secret for customer managed Transparent data encryption mode. + * + * @return the protectorSecret value. + */ + public String protectorSecret() { + return this.protectorSecret; + } + + /** + * Set the protectorSecret property: Protector secret for customer managed Transparent data encryption mode. + * + * @param protectorSecret the protectorSecret value to set. + * @return the K8StransparentDataEncryption object itself. + */ + public K8StransparentDataEncryption withProtectorSecret(String protectorSecret) { + this.protectorSecret = protectorSecret; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("mode", this.mode); + jsonWriter.writeStringField("protectorSecret", this.protectorSecret); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of K8StransparentDataEncryption from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of K8StransparentDataEncryption if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the K8StransparentDataEncryption. + */ + public static K8StransparentDataEncryption fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + K8StransparentDataEncryption deserializedK8StransparentDataEncryption = new K8StransparentDataEncryption(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("mode".equals(fieldName)) { + deserializedK8StransparentDataEncryption.mode = reader.getString(); + } else if ("protectorSecret".equals(fieldName)) { + deserializedK8StransparentDataEncryption.protectorSecret = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedK8StransparentDataEncryption; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/KeytabInformation.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/KeytabInformation.java new file mode 100644 index 000000000000..588a76bff576 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/KeytabInformation.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Keytab used for authenticate with Active Directory. + */ +@Fluent +public final class KeytabInformation implements JsonSerializable { + /* + * A base64-encoded keytab. + */ + private String keytab; + + /** + * Creates an instance of KeytabInformation class. + */ + public KeytabInformation() { + } + + /** + * Get the keytab property: A base64-encoded keytab. + * + * @return the keytab value. + */ + public String keytab() { + return this.keytab; + } + + /** + * Set the keytab property: A base64-encoded keytab. + * + * @param keytab the keytab value to set. + * @return the KeytabInformation object itself. + */ + public KeytabInformation withKeytab(String keytab) { + this.keytab = keytab; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("keytab", this.keytab); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KeytabInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KeytabInformation if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the KeytabInformation. + */ + public static KeytabInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KeytabInformation deserializedKeytabInformation = new KeytabInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keytab".equals(fieldName)) { + deserializedKeytabInformation.keytab = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKeytabInformation; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LastExecutionStatus.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LastExecutionStatus.java new file mode 100644 index 000000000000..6e04fd000305 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LastExecutionStatus.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The last execution status of the background job. + */ +public final class LastExecutionStatus extends ExpandableStringEnum { + /** + * Static value Succeeded for LastExecutionStatus. + */ + public static final LastExecutionStatus SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Completed for LastExecutionStatus. + */ + public static final LastExecutionStatus COMPLETED = fromString("Completed"); + + /** + * Static value Failed for LastExecutionStatus. + */ + public static final LastExecutionStatus FAILED = fromString("Failed"); + + /** + * Static value Faulted for LastExecutionStatus. + */ + public static final LastExecutionStatus FAULTED = fromString("Faulted"); + + /** + * Static value Postponed for LastExecutionStatus. + */ + public static final LastExecutionStatus POSTPONED = fromString("Postponed"); + + /** + * Static value Rescheduled for LastExecutionStatus. + */ + public static final LastExecutionStatus RESCHEDULED = fromString("Rescheduled"); + + /** + * Creates a new instance of LastExecutionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LastExecutionStatus() { + } + + /** + * Creates or finds a LastExecutionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding LastExecutionStatus. + */ + public static LastExecutionStatus fromString(String name) { + return fromString(name, LastExecutionStatus.class); + } + + /** + * Gets known LastExecutionStatus values. + * + * @return known LastExecutionStatus values. + */ + public static Collection values() { + return values(LastExecutionStatus.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LicenseCategory.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LicenseCategory.java new file mode 100644 index 000000000000..8267c6440841 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LicenseCategory.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * This property represents the choice between SQL Server Core and ESU licenses. + */ +public final class LicenseCategory extends ExpandableStringEnum { + /** + * Static value Core for LicenseCategory. + */ + public static final LicenseCategory CORE = fromString("Core"); + + /** + * Creates a new instance of LicenseCategory value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LicenseCategory() { + } + + /** + * Creates or finds a LicenseCategory from its string representation. + * + * @param name a name to look for. + * @return the corresponding LicenseCategory. + */ + public static LicenseCategory fromString(String name) { + return fromString(name, LicenseCategory.class); + } + + /** + * Gets known LicenseCategory values. + * + * @return known LicenseCategory values. + */ + public static Collection values() { + return values(LicenseCategory.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LogAnalyticsWorkspaceConfig.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LogAnalyticsWorkspaceConfig.java index b5b5e7d56011..ed5542f03bf9 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LogAnalyticsWorkspaceConfig.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LogAnalyticsWorkspaceConfig.java @@ -5,31 +5,38 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Objects; import java.util.UUID; -/** Log analytics workspace id and primary key. */ +/** + * Log analytics workspace id and primary key. + */ @Fluent -public final class LogAnalyticsWorkspaceConfig { +public final class LogAnalyticsWorkspaceConfig implements JsonSerializable { /* * Azure Log Analytics workspace ID */ - @JsonProperty(value = "workspaceId") private UUID workspaceId; /* * Primary key of the workspace */ - @JsonProperty(value = "primaryKey") private String primaryKey; - /** Creates an instance of LogAnalyticsWorkspaceConfig class. */ + /** + * Creates an instance of LogAnalyticsWorkspaceConfig class. + */ public LogAnalyticsWorkspaceConfig() { } /** * Get the workspaceId property: Azure Log Analytics workspace ID. - * + * * @return the workspaceId value. */ public UUID workspaceId() { @@ -38,7 +45,7 @@ public UUID workspaceId() { /** * Set the workspaceId property: Azure Log Analytics workspace ID. - * + * * @param workspaceId the workspaceId value to set. * @return the LogAnalyticsWorkspaceConfig object itself. */ @@ -49,7 +56,7 @@ public LogAnalyticsWorkspaceConfig withWorkspaceId(UUID workspaceId) { /** * Get the primaryKey property: Primary key of the workspace. - * + * * @return the primaryKey value. */ public String primaryKey() { @@ -58,7 +65,7 @@ public String primaryKey() { /** * Set the primaryKey property: Primary key of the workspace. - * + * * @param primaryKey the primaryKey value to set. * @return the LogAnalyticsWorkspaceConfig object itself. */ @@ -69,9 +76,49 @@ public LogAnalyticsWorkspaceConfig withPrimaryKey(String primaryKey) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("workspaceId", Objects.toString(this.workspaceId, null)); + jsonWriter.writeStringField("primaryKey", this.primaryKey); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LogAnalyticsWorkspaceConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LogAnalyticsWorkspaceConfig if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the LogAnalyticsWorkspaceConfig. + */ + public static LogAnalyticsWorkspaceConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LogAnalyticsWorkspaceConfig deserializedLogAnalyticsWorkspaceConfig = new LogAnalyticsWorkspaceConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("workspaceId".equals(fieldName)) { + deserializedLogAnalyticsWorkspaceConfig.workspaceId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("primaryKey".equals(fieldName)) { + deserializedLogAnalyticsWorkspaceConfig.primaryKey = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLogAnalyticsWorkspaceConfig; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Migration.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Migration.java new file mode 100644 index 000000000000..063e5d3b4dd8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Migration.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Migration related configuration. + */ +@Fluent +public final class Migration implements JsonSerializable { + /* + * Migration assessments related configuration. + */ + private MigrationAssessment assessment; + + /** + * Creates an instance of Migration class. + */ + public Migration() { + } + + /** + * Get the assessment property: Migration assessments related configuration. + * + * @return the assessment value. + */ + public MigrationAssessment assessment() { + return this.assessment; + } + + /** + * Set the assessment property: Migration assessments related configuration. + * + * @param assessment the assessment value to set. + * @return the Migration object itself. + */ + public Migration withAssessment(MigrationAssessment assessment) { + this.assessment = assessment; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (assessment() != null) { + assessment().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("assessment", this.assessment); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Migration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Migration if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Migration. + */ + public static Migration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Migration deserializedMigration = new Migration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("assessment".equals(fieldName)) { + deserializedMigration.assessment = MigrationAssessment.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMigration; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationAssessment.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationAssessment.java new file mode 100644 index 000000000000..4164bf1c56e1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationAssessment.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * The migration assessment related configuration. + */ +@Fluent +public final class MigrationAssessment implements JsonSerializable { + /* + * Indicates if migration assessment is enabled for this SQL Server instance. + */ + private Boolean enabled; + + /* + * The time when Migration Assessment Report upload was last performed. + */ + private OffsetDateTime assessmentUploadTime; + + /* + * Issues and warnings impacting the migration of SQL Server instance to particular Azure Migration Target. + */ + private List serverAssessments; + + /* + * SKU Recommendation results for Azure migration targets for SQL Server. + */ + private SkuRecommendationResults skuRecommendationResults; + + /** + * Creates an instance of MigrationAssessment class. + */ + public MigrationAssessment() { + } + + /** + * Get the enabled property: Indicates if migration assessment is enabled for this SQL Server instance. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates if migration assessment is enabled for this SQL Server instance. + * + * @param enabled the enabled value to set. + * @return the MigrationAssessment object itself. + */ + public MigrationAssessment withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the assessmentUploadTime property: The time when Migration Assessment Report upload was last performed. + * + * @return the assessmentUploadTime value. + */ + public OffsetDateTime assessmentUploadTime() { + return this.assessmentUploadTime; + } + + /** + * Get the serverAssessments property: Issues and warnings impacting the migration of SQL Server instance to + * particular Azure Migration Target. + * + * @return the serverAssessments value. + */ + public List serverAssessments() { + return this.serverAssessments; + } + + /** + * Get the skuRecommendationResults property: SKU Recommendation results for Azure migration targets for SQL Server. + * + * @return the skuRecommendationResults value. + */ + public SkuRecommendationResults skuRecommendationResults() { + return this.skuRecommendationResults; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverAssessments() != null) { + serverAssessments().forEach(e -> e.validate()); + } + if (skuRecommendationResults() != null) { + skuRecommendationResults().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MigrationAssessment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MigrationAssessment if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MigrationAssessment. + */ + public static MigrationAssessment fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MigrationAssessment deserializedMigrationAssessment = new MigrationAssessment(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedMigrationAssessment.enabled = reader.getNullable(JsonReader::getBoolean); + } else if ("assessmentUploadTime".equals(fieldName)) { + deserializedMigrationAssessment.assessmentUploadTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("serverAssessments".equals(fieldName)) { + List serverAssessments + = reader.readArray(reader1 -> ServerAssessmentsItem.fromJson(reader1)); + deserializedMigrationAssessment.serverAssessments = serverAssessments; + } else if ("skuRecommendationResults".equals(fieldName)) { + deserializedMigrationAssessment.skuRecommendationResults + = SkuRecommendationResults.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMigrationAssessment; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Monitoring.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Monitoring.java new file mode 100644 index 000000000000..03ec390ade2a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Monitoring.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The monitoring configuration. + */ +@Fluent +public final class Monitoring implements JsonSerializable { + /* + * Indicates if monitoring is enabled for this SQL Server instance. + */ + private Boolean enabled; + + /** + * Creates an instance of Monitoring class. + */ + public Monitoring() { + } + + /** + * Get the enabled property: Indicates if monitoring is enabled for this SQL Server instance. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates if monitoring is enabled for this SQL Server instance. + * + * @param enabled the enabled value to set. + * @return the Monitoring object itself. + */ + public Monitoring withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Monitoring from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Monitoring if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Monitoring. + */ + public static Monitoring fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Monitoring deserializedMonitoring = new Monitoring(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedMonitoring.enabled = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedMonitoring; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OnPremiseProperty.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OnPremiseProperty.java index cfbc0babe070..43c18ce1ce49 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OnPremiseProperty.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OnPremiseProperty.java @@ -6,37 +6,43 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Objects; import java.util.UUID; -/** Properties from the Kubernetes data controller. */ +/** + * Properties from the Kubernetes data controller. + */ @Fluent -public final class OnPremiseProperty { +public final class OnPremiseProperty implements JsonSerializable { /* * A globally unique ID identifying the associated Kubernetes cluster */ - @JsonProperty(value = "id", required = true) private UUID id; /* * Certificate that contains the Kubernetes cluster public key used to verify signing */ - @JsonProperty(value = "publicSigningKey", required = true) private String publicSigningKey; /* * Unique thumbprint returned to customer to verify the certificate being uploaded */ - @JsonProperty(value = "signingCertificateThumbprint") private String signingCertificateThumbprint; - /** Creates an instance of OnPremiseProperty class. */ + /** + * Creates an instance of OnPremiseProperty class. + */ public OnPremiseProperty() { } /** * Get the id property: A globally unique ID identifying the associated Kubernetes cluster. - * + * * @return the id value. */ public UUID id() { @@ -45,7 +51,7 @@ public UUID id() { /** * Set the id property: A globally unique ID identifying the associated Kubernetes cluster. - * + * * @param id the id value to set. * @return the OnPremiseProperty object itself. */ @@ -57,7 +63,7 @@ public OnPremiseProperty withId(UUID id) { /** * Get the publicSigningKey property: Certificate that contains the Kubernetes cluster public key used to verify * signing. - * + * * @return the publicSigningKey value. */ public String publicSigningKey() { @@ -67,7 +73,7 @@ public String publicSigningKey() { /** * Set the publicSigningKey property: Certificate that contains the Kubernetes cluster public key used to verify * signing. - * + * * @param publicSigningKey the publicSigningKey value to set. * @return the OnPremiseProperty object itself. */ @@ -79,7 +85,7 @@ public OnPremiseProperty withPublicSigningKey(String publicSigningKey) { /** * Get the signingCertificateThumbprint property: Unique thumbprint returned to customer to verify the certificate * being uploaded. - * + * * @return the signingCertificateThumbprint value. */ public String signingCertificateThumbprint() { @@ -89,7 +95,7 @@ public String signingCertificateThumbprint() { /** * Set the signingCertificateThumbprint property: Unique thumbprint returned to customer to verify the certificate * being uploaded. - * + * * @param signingCertificateThumbprint the signingCertificateThumbprint value to set. * @return the OnPremiseProperty object itself. */ @@ -100,22 +106,64 @@ public OnPremiseProperty withSigningCertificateThumbprint(String signingCertific /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (id() == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException("Missing required property id in model OnPremiseProperty")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property id in model OnPremiseProperty")); } if (publicSigningKey() == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - "Missing required property publicSigningKey in model OnPremiseProperty")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property publicSigningKey in model OnPremiseProperty")); } } private static final ClientLogger LOGGER = new ClientLogger(OnPremiseProperty.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", Objects.toString(this.id, null)); + jsonWriter.writeStringField("publicSigningKey", this.publicSigningKey); + jsonWriter.writeStringField("signingCertificateThumbprint", this.signingCertificateThumbprint); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OnPremiseProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OnPremiseProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OnPremiseProperty. + */ + public static OnPremiseProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OnPremiseProperty deserializedOnPremiseProperty = new OnPremiseProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedOnPremiseProperty.id + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("publicSigningKey".equals(fieldName)) { + deserializedOnPremiseProperty.publicSigningKey = reader.getString(); + } else if ("signingCertificateThumbprint".equals(fieldName)) { + deserializedOnPremiseProperty.signingCertificateThumbprint = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOnPremiseProperty; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Operation.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Operation.java index ec2a3d7c4a1e..d0c0e0002183 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Operation.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Operation.java @@ -7,46 +7,48 @@ import com.azure.resourcemanager.azurearcdata.fluent.models.OperationInner; import java.util.Map; -/** An immutable client-side representation of Operation. */ +/** + * 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 / action. - * + * * @return the display value. */ OperationDisplay display(); /** * Gets the origin property: The intended executor of the operation. - * + * * @return the origin value. */ OperationOrigin origin(); /** * Gets the isDataAction property: Indicates whether the operation is a data action. - * + * * @return the isDataAction value. */ boolean isDataAction(); /** * Gets the properties property: Additional descriptions for the operation. - * + * * @return the properties value. */ Map properties(); /** * Gets the inner com.azure.resourcemanager.azurearcdata.fluent.models.OperationInner object. - * + * * @return the inner object. */ OperationInner innerModel(); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationDisplay.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationDisplay.java index 88a3cb32a929..94296bfe3d1a 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationDisplay.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationDisplay.java @@ -6,42 +6,46 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Display metadata associated with the operation. */ +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Display metadata associated with the operation. + */ @Fluent -public final class OperationDisplay { +public final class OperationDisplay implements JsonSerializable { /* * The localized friendly form of the resource provider name. */ - @JsonProperty(value = "provider", required = true) private String provider; /* * The localized friendly form of the resource type related to this action/operation. */ - @JsonProperty(value = "resource", required = true) private String resource; /* * The localized friendly name for the operation. */ - @JsonProperty(value = "operation", required = true) private String operation; /* * The localized friendly description for the operation. */ - @JsonProperty(value = "description", required = true) private String description; - /** Creates an instance of OperationDisplay class. */ + /** + * Creates an instance of OperationDisplay class. + */ public OperationDisplay() { } /** * Get the provider property: The localized friendly form of the resource provider name. - * + * * @return the provider value. */ public String provider() { @@ -50,7 +54,7 @@ public String provider() { /** * Set the provider property: The localized friendly form of the resource provider name. - * + * * @param provider the provider value to set. * @return the OperationDisplay object itself. */ @@ -61,7 +65,7 @@ public OperationDisplay withProvider(String provider) { /** * Get the resource property: The localized friendly form of the resource type related to this action/operation. - * + * * @return the resource value. */ public String resource() { @@ -70,7 +74,7 @@ public String resource() { /** * Set the resource property: The localized friendly form of the resource type related to this action/operation. - * + * * @param resource the resource value to set. * @return the OperationDisplay object itself. */ @@ -81,7 +85,7 @@ public OperationDisplay withResource(String resource) { /** * Get the operation property: The localized friendly name for the operation. - * + * * @return the operation value. */ public String operation() { @@ -90,7 +94,7 @@ public String operation() { /** * Set the operation property: The localized friendly name for the operation. - * + * * @param operation the operation value to set. * @return the OperationDisplay object itself. */ @@ -101,7 +105,7 @@ public OperationDisplay withOperation(String operation) { /** * Get the description property: The localized friendly description for the operation. - * + * * @return the description value. */ public String description() { @@ -110,7 +114,7 @@ public String description() { /** * Set the description property: The localized friendly description for the operation. - * + * * @param description the description value to set. * @return the OperationDisplay object itself. */ @@ -121,31 +125,73 @@ public OperationDisplay withDescription(String description) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (provider() == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException("Missing required property provider in model OperationDisplay")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property provider in model OperationDisplay")); } if (resource() == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException("Missing required property resource in model OperationDisplay")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property resource in model OperationDisplay")); } if (operation() == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException("Missing required property operation in model OperationDisplay")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property operation in model OperationDisplay")); } if (description() == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException("Missing required property description in model OperationDisplay")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property description in model OperationDisplay")); } } private static final ClientLogger LOGGER = new ClientLogger(OperationDisplay.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("provider", this.provider); + jsonWriter.writeStringField("resource", this.resource); + jsonWriter.writeStringField("operation", this.operation); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationListResult.java index 383744f394f4..b0102ac2b87e 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationListResult.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationListResult.java @@ -5,32 +5,38 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.azurearcdata.fluent.models.OperationInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** Result of the request to list Azure Data Services on Azure Arc operations. */ +/** + * Result of the request to list Azure Data Services on Azure Arc operations. + */ @Immutable -public final class OperationListResult { +public final class OperationListResult implements JsonSerializable { /* * Array of results. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * Link to retrieve next page of results. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; - /** Creates an instance of OperationListResult class. */ + /** + * Creates an instance of OperationListResult class. + */ public OperationListResult() { } /** * Get the value property: Array of results. - * + * * @return the value value. */ public List value() { @@ -39,7 +45,7 @@ public List value() { /** * Get the nextLink property: Link to retrieve next page of results. - * + * * @return the nextLink value. */ public String nextLink() { @@ -48,7 +54,7 @@ public String nextLink() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -56,4 +62,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationOrigin.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationOrigin.java index 03d73c6be7b7..8043e2073dfe 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationOrigin.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationOrigin.java @@ -5,20 +5,25 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** The intended executor of the operation. */ +/** + * The intended executor of the operation. + */ public final class OperationOrigin extends ExpandableStringEnum { - /** Static value user for OperationOrigin. */ + /** + * Static value user for OperationOrigin. + */ public static final OperationOrigin USER = fromString("user"); - /** Static value system for OperationOrigin. */ + /** + * 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 @@ -27,18 +32,17 @@ 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() { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Operations.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Operations.java index c93a1a532c35..d512fcd0bd98 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Operations.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Operations.java @@ -7,27 +7,29 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; -/** Resource collection API of Operations. */ +/** + * Resource collection API of Operations. + */ public interface Operations { /** * Lists all of the available Azure Data Services on Azure Arc 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 result of the request to list Azure Data Services on Azure Arc operations as paginated response with - * {@link PagedIterable}. + * {@link PagedIterable}. */ PagedIterable list(); /** * Lists all of the available Azure Data Services on Azure Arc 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 result of the request to list Azure Data Services on Azure Arc operations as paginated response with - * {@link PagedIterable}. + * {@link PagedIterable}. */ PagedIterable list(Context context); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PageOfDataControllerResource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PageOfDataControllerResource.java index 8ff58f8c8824..5ed2624ea37a 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PageOfDataControllerResource.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PageOfDataControllerResource.java @@ -5,32 +5,38 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.azurearcdata.fluent.models.DataControllerResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** The PageOfDataControllerResource model. */ +/** + * A list of data controllers. + */ @Fluent -public final class PageOfDataControllerResource { +public final class PageOfDataControllerResource implements JsonSerializable { /* - * The value property. + * Array of results. */ - @JsonProperty(value = "value") private List value; /* * Link to retrieve next page of results. */ - @JsonProperty(value = "nextLink") private String nextLink; - /** Creates an instance of PageOfDataControllerResource class. */ + /** + * Creates an instance of PageOfDataControllerResource class. + */ public PageOfDataControllerResource() { } /** - * Get the value property: The value property. - * + * Get the value property: Array of results. + * * @return the value value. */ public List value() { @@ -38,8 +44,8 @@ public List value() { } /** - * Set the value property: The value property. - * + * Set the value property: Array of results. + * * @param value the value value to set. * @return the PageOfDataControllerResource object itself. */ @@ -50,7 +56,7 @@ public PageOfDataControllerResource withValue(List /** * Get the nextLink property: Link to retrieve next page of results. - * + * * @return the nextLink value. */ public String nextLink() { @@ -59,7 +65,7 @@ public String nextLink() { /** * Set the nextLink property: Link to retrieve next page of results. - * + * * @param nextLink the nextLink value to set. * @return the PageOfDataControllerResource object itself. */ @@ -70,7 +76,7 @@ public PageOfDataControllerResource withNextLink(String nextLink) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -78,4 +84,45 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PageOfDataControllerResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PageOfDataControllerResource if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PageOfDataControllerResource. + */ + public static PageOfDataControllerResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PageOfDataControllerResource deserializedPageOfDataControllerResource = new PageOfDataControllerResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> DataControllerResourceInner.fromJson(reader1)); + deserializedPageOfDataControllerResource.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPageOfDataControllerResource.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPageOfDataControllerResource; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstance.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstance.java new file mode 100644 index 000000000000..90ea1a616837 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstance.java @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.PostgresInstanceInner; +import java.util.Map; + +/** + * An immutable client-side representation of PostgresInstance. + */ +public interface PostgresInstance { + /** + * 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 extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the properties property: null. + * + * @return the properties value. + */ + PostgresInstanceProperties properties(); + + /** + * Gets the sku property: Resource sku. + * + * @return the sku value. + */ + PostgresInstanceSku sku(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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.azurearcdata.fluent.models.PostgresInstanceInner object. + * + * @return the inner object. + */ + PostgresInstanceInner innerModel(); + + /** + * The entirety of the PostgresInstance definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * The PostgresInstance definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the PostgresInstance definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the PostgresInstance 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 PostgresInstance definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the Azure resource group. + * @return the next definition stage. + */ + WithProperties withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the PostgresInstance definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: null. + * + * @param properties null. + * @return the next definition stage. + */ + WithCreate withProperties(PostgresInstanceProperties properties); + } + + /** + * The stage of the PostgresInstance 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.WithExtendedLocation, DefinitionStages.WithSku { + /** + * Executes the create request. + * + * @return the created resource. + */ + PostgresInstance create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PostgresInstance create(Context context); + } + + /** + * The stage of the PostgresInstance 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 PostgresInstance definition allowing to specify extendedLocation. + */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extendedLocation of the resource.. + * + * @param extendedLocation The extendedLocation of the resource. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + + /** + * The stage of the PostgresInstance definition allowing to specify sku. + */ + interface WithSku { + /** + * Specifies the sku property: Resource sku.. + * + * @param sku Resource sku. + * @return the next definition stage. + */ + WithCreate withSku(PostgresInstanceSku sku); + } + } + + /** + * Begins update for the PostgresInstance resource. + * + * @return the stage of resource update. + */ + PostgresInstance.Update update(); + + /** + * The template for PostgresInstance update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PostgresInstance apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PostgresInstance apply(Context context); + } + + /** + * The PostgresInstance update stages. + */ + interface UpdateStages { + /** + * The stage of the PostgresInstance update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the PostgresInstance update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Postgres Instance properties.. + * + * @param properties Postgres Instance properties. + * @return the next definition stage. + */ + Update withProperties(PostgresInstanceProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PostgresInstance refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PostgresInstance refresh(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceListResult.java new file mode 100644 index 000000000000..2c20fb42f114 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceListResult.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.fluent.models.PostgresInstanceInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of PostgresInstance. + */ +@Immutable +public final class PostgresInstanceListResult implements JsonSerializable { + /* + * Array of results. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of PostgresInstanceListResult class. + */ + public PostgresInstanceListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PostgresInstanceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PostgresInstanceListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PostgresInstanceListResult. + */ + public static PostgresInstanceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PostgresInstanceListResult deserializedPostgresInstanceListResult = new PostgresInstanceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PostgresInstanceInner.fromJson(reader1)); + deserializedPostgresInstanceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPostgresInstanceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPostgresInstanceListResult; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceProperties.java new file mode 100644 index 000000000000..c7f8e4f3ceb9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceProperties.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.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Postgres Instance properties. + */ +@Fluent +public final class PostgresInstanceProperties implements JsonSerializable { + /* + * The data controller id + */ + private String dataControllerId; + + /* + * The instance admin + */ + private String admin; + + /* + * Username and password for basic authentication. + */ + private BasicLoginInformation basicLoginInformation; + + /* + * The raw kubernetes information + */ + private Object k8SRaw; + + /* + * Last uploaded date from Kubernetes cluster. Defaults to current date time + */ + private OffsetDateTime lastUploadedDate; + + /* + * The provisioning state of the Azure Arc-enabled PostgreSQL instance. + */ + private String provisioningState; + + /** + * Creates an instance of PostgresInstanceProperties class. + */ + public PostgresInstanceProperties() { + } + + /** + * Get the dataControllerId property: The data controller id. + * + * @return the dataControllerId value. + */ + public String dataControllerId() { + return this.dataControllerId; + } + + /** + * Set the dataControllerId property: The data controller id. + * + * @param dataControllerId the dataControllerId value to set. + * @return the PostgresInstanceProperties object itself. + */ + public PostgresInstanceProperties withDataControllerId(String dataControllerId) { + this.dataControllerId = dataControllerId; + return this; + } + + /** + * Get the admin property: The instance admin. + * + * @return the admin value. + */ + public String admin() { + return this.admin; + } + + /** + * Set the admin property: The instance admin. + * + * @param admin the admin value to set. + * @return the PostgresInstanceProperties object itself. + */ + public PostgresInstanceProperties withAdmin(String admin) { + this.admin = admin; + return this; + } + + /** + * Get the basicLoginInformation property: Username and password for basic authentication. + * + * @return the basicLoginInformation value. + */ + public BasicLoginInformation basicLoginInformation() { + return this.basicLoginInformation; + } + + /** + * Set the basicLoginInformation property: Username and password for basic authentication. + * + * @param basicLoginInformation the basicLoginInformation value to set. + * @return the PostgresInstanceProperties object itself. + */ + public PostgresInstanceProperties withBasicLoginInformation(BasicLoginInformation basicLoginInformation) { + this.basicLoginInformation = basicLoginInformation; + return this; + } + + /** + * Get the k8SRaw property: The raw kubernetes information. + * + * @return the k8SRaw value. + */ + public Object k8SRaw() { + return this.k8SRaw; + } + + /** + * Set the k8SRaw property: The raw kubernetes information. + * + * @param k8SRaw the k8SRaw value to set. + * @return the PostgresInstanceProperties object itself. + */ + public PostgresInstanceProperties withK8SRaw(Object k8SRaw) { + this.k8SRaw = k8SRaw; + return this; + } + + /** + * Get the lastUploadedDate property: Last uploaded date from Kubernetes cluster. Defaults to current date time. + * + * @return the lastUploadedDate value. + */ + public OffsetDateTime lastUploadedDate() { + return this.lastUploadedDate; + } + + /** + * Set the lastUploadedDate property: Last uploaded date from Kubernetes cluster. Defaults to current date time. + * + * @param lastUploadedDate the lastUploadedDate value to set. + * @return the PostgresInstanceProperties object itself. + */ + public PostgresInstanceProperties withLastUploadedDate(OffsetDateTime lastUploadedDate) { + this.lastUploadedDate = lastUploadedDate; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the Azure Arc-enabled PostgreSQL instance. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (basicLoginInformation() != null) { + basicLoginInformation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dataControllerId", this.dataControllerId); + jsonWriter.writeStringField("admin", this.admin); + jsonWriter.writeJsonField("basicLoginInformation", this.basicLoginInformation); + jsonWriter.writeUntypedField("k8sRaw", this.k8SRaw); + jsonWriter.writeStringField("lastUploadedDate", + this.lastUploadedDate == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUploadedDate)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PostgresInstanceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PostgresInstanceProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PostgresInstanceProperties. + */ + public static PostgresInstanceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PostgresInstanceProperties deserializedPostgresInstanceProperties = new PostgresInstanceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataControllerId".equals(fieldName)) { + deserializedPostgresInstanceProperties.dataControllerId = reader.getString(); + } else if ("admin".equals(fieldName)) { + deserializedPostgresInstanceProperties.admin = reader.getString(); + } else if ("basicLoginInformation".equals(fieldName)) { + deserializedPostgresInstanceProperties.basicLoginInformation + = BasicLoginInformation.fromJson(reader); + } else if ("k8sRaw".equals(fieldName)) { + deserializedPostgresInstanceProperties.k8SRaw = reader.readUntyped(); + } else if ("lastUploadedDate".equals(fieldName)) { + deserializedPostgresInstanceProperties.lastUploadedDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedPostgresInstanceProperties.provisioningState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPostgresInstanceProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSku.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSku.java new file mode 100644 index 000000000000..8daf2062a2d8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSku.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The resource model definition representing SKU for Azure Database for PostgresSQL - Azure Arc. + */ +@Fluent +public final class PostgresInstanceSku extends CommonSku { + /* + * This field is required to be implemented by the Resource Provider if the service has more than one tier. + */ + private PostgresInstanceSkuTier tier; + + /** + * Creates an instance of PostgresInstanceSku class. + */ + public PostgresInstanceSku() { + } + + /** + * Get the tier property: This field is required to be implemented by the Resource Provider if the service has more + * than one tier. + * + * @return the tier value. + */ + public PostgresInstanceSkuTier tier() { + return this.tier; + } + + /** + * Set the tier property: This field is required to be implemented by the Resource Provider if the service has more + * than one tier. + * + * @param tier the tier value to set. + * @return the PostgresInstanceSku object itself. + */ + public PostgresInstanceSku withTier(PostgresInstanceSkuTier tier) { + this.tier = tier; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PostgresInstanceSku withName(String name) { + super.withName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PostgresInstanceSku withDev(Boolean dev) { + super.withDev(dev); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PostgresInstanceSku withSize(String size) { + super.withSize(size); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PostgresInstanceSku withFamily(String family) { + super.withFamily(family); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PostgresInstanceSku withCapacity(Integer capacity) { + super.withCapacity(capacity); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model PostgresInstanceSku")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PostgresInstanceSku.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", name()); + jsonWriter.writeBooleanField("dev", dev()); + jsonWriter.writeStringField("size", size()); + jsonWriter.writeStringField("family", family()); + jsonWriter.writeNumberField("capacity", capacity()); + jsonWriter.writeStringField("tier", this.tier == null ? null : this.tier.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PostgresInstanceSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PostgresInstanceSku if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PostgresInstanceSku. + */ + public static PostgresInstanceSku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PostgresInstanceSku deserializedPostgresInstanceSku = new PostgresInstanceSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedPostgresInstanceSku.withName(reader.getString()); + } else if ("dev".equals(fieldName)) { + deserializedPostgresInstanceSku.withDev(reader.getNullable(JsonReader::getBoolean)); + } else if ("size".equals(fieldName)) { + deserializedPostgresInstanceSku.withSize(reader.getString()); + } else if ("family".equals(fieldName)) { + deserializedPostgresInstanceSku.withFamily(reader.getString()); + } else if ("capacity".equals(fieldName)) { + deserializedPostgresInstanceSku.withCapacity(reader.getNullable(JsonReader::getInt)); + } else if ("tier".equals(fieldName)) { + deserializedPostgresInstanceSku.tier = PostgresInstanceSkuTier.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPostgresInstanceSku; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSkuTier.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSkuTier.java new file mode 100644 index 000000000000..47ccab7f3f83 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSkuTier.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.azurearcdata.models; + +/** + * This field is required to be implemented by the Resource Provider if the service has more than one tier. + */ +public enum PostgresInstanceSkuTier { + /** + * Enum value Hyperscale. + */ + HYPERSCALE("Hyperscale"); + + /** + * The actual serialized value for a PostgresInstanceSkuTier instance. + */ + private final String value; + + PostgresInstanceSkuTier(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PostgresInstanceSkuTier instance. + * + * @param value the serialized value to parse. + * @return the parsed PostgresInstanceSkuTier object, or null if unable to parse. + */ + public static PostgresInstanceSkuTier fromString(String value) { + if (value == null) { + return null; + } + PostgresInstanceSkuTier[] items = PostgresInstanceSkuTier.values(); + for (PostgresInstanceSkuTier item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceUpdate.java new file mode 100644 index 000000000000..a55035132617 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceUpdate.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * An update to a Postgres Instance. + */ +@Fluent +public final class PostgresInstanceUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * Postgres Instance properties. + */ + private PostgresInstanceProperties properties; + + /** + * Creates an instance of PostgresInstanceUpdate class. + */ + public PostgresInstanceUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the PostgresInstanceUpdate object itself. + */ + public PostgresInstanceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: Postgres Instance properties. + * + * @return the properties value. + */ + public PostgresInstanceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Postgres Instance properties. + * + * @param properties the properties value to set. + * @return the PostgresInstanceUpdate object itself. + */ + public PostgresInstanceUpdate withProperties(PostgresInstanceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PostgresInstanceUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PostgresInstanceUpdate if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the PostgresInstanceUpdate. + */ + public static PostgresInstanceUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PostgresInstanceUpdate deserializedPostgresInstanceUpdate = new PostgresInstanceUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPostgresInstanceUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedPostgresInstanceUpdate.properties = PostgresInstanceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPostgresInstanceUpdate; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstances.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstances.java new file mode 100644 index 000000000000..10667bf62fad --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstances.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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 PostgresInstances. + */ +public interface PostgresInstances { + /** + * List postgres Instance resources in the 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 PostgresInstance as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List postgres Instance resources in the 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 PostgresInstance as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a postgres Instances list by Resource group name as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a postgres Instances list by Resource group name as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String postgresInstanceName, + Context context); + + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + PostgresInstance getByResourceGroup(String resourceGroupName, String postgresInstanceName); + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 postgresInstanceName); + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 postgresInstanceName, Context context); + + /** + * Retrieves a postgres Instance resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response}. + */ + PostgresInstance getById(String id); + + /** + * Retrieves a postgres Instance resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a postgres Instance resource. + * + * @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 postgres Instance resource. + * + * @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 PostgresInstance resource. + * + * @param name resource name. + * @return the first stage of the new PostgresInstance definition. + */ + PostgresInstance.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PrimaryAllowConnections.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PrimaryAllowConnections.java new file mode 100644 index 000000000000..cf5a91106649 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PrimaryAllowConnections.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.azurearcdata.models; + +/** + * Whether the primary replica should allow all connections or only READ_WRITE connections (disallowing ReadOnly + * connections). + */ +public enum PrimaryAllowConnections { + /** + * Enum value ALL. + */ + ALL("ALL"), + + /** + * Enum value READ_WRITE. + */ + READ_WRITE("READ_WRITE"); + + /** + * The actual serialized value for a PrimaryAllowConnections instance. + */ + private final String value; + + PrimaryAllowConnections(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PrimaryAllowConnections instance. + * + * @param value the serialized value to parse. + * @return the parsed PrimaryAllowConnections object, or null if unable to parse. + */ + public static PrimaryAllowConnections fromString(String value) { + if (value == null) { + return null; + } + PrimaryAllowConnections[] items = PrimaryAllowConnections.values(); + for (PrimaryAllowConnections item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ProvisioningState.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ProvisioningState.java new file mode 100644 index 000000000000..ea932b67a645 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ProvisioningState.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of the failover group resource. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Static value Succeeded for ProvisioningState. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ProvisioningState. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ProvisioningState. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Static value Accepted for ProvisioningState. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * 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. + */ + 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/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/RecommendationStatus.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/RecommendationStatus.java new file mode 100644 index 000000000000..802c9baffa01 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/RecommendationStatus.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The target recommendation Status for this database. + */ +public final class RecommendationStatus extends ExpandableStringEnum { + /** + * Static value NotReady for RecommendationStatus. + */ + public static final RecommendationStatus NOT_READY = fromString("NotReady"); + + /** + * Static value Ready for RecommendationStatus. + */ + public static final RecommendationStatus READY = fromString("Ready"); + + /** + * Static value Unknown for RecommendationStatus. + */ + public static final RecommendationStatus UNKNOWN = fromString("Unknown"); + + /** + * Creates a new instance of RecommendationStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RecommendationStatus() { + } + + /** + * Creates or finds a RecommendationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecommendationStatus. + */ + public static RecommendationStatus fromString(String name) { + return fromString(name, RecommendationStatus.class); + } + + /** + * Gets known RecommendationStatus values. + * + * @return known RecommendationStatus values. + */ + public static Collection values() { + return values(RecommendationStatus.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/RecoveryMode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/RecoveryMode.java new file mode 100644 index 000000000000..12a46d848fcb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/RecoveryMode.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Status of the database. + */ +public final class RecoveryMode extends ExpandableStringEnum { + /** + * Static value Full for RecoveryMode. + */ + public static final RecoveryMode FULL = fromString("Full"); + + /** + * Static value Bulk-logged for RecoveryMode. + */ + public static final RecoveryMode BULK_LOGGED = fromString("Bulk-logged"); + + /** + * Static value Simple for RecoveryMode. + */ + public static final RecoveryMode SIMPLE = fromString("Simple"); + + /** + * Creates a new instance of RecoveryMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RecoveryMode() { + } + + /** + * Creates or finds a RecoveryMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecoveryMode. + */ + public static RecoveryMode fromString(String name) { + return fromString(name, RecoveryMode.class); + } + + /** + * Gets known RecoveryMode values. + * + * @return known RecoveryMode values. + */ + public static Collection values() { + return values(RecoveryMode.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ReplicationPartnerType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ReplicationPartnerType.java new file mode 100644 index 000000000000..b2abb69602d0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ReplicationPartnerType.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * Defines values for ReplicationPartnerType. + */ +public enum ReplicationPartnerType { + /** + * Enum value SQLServer. + */ + SQLSERVER("SQLServer"), + + /** + * Enum value AzureSQLVM. + */ + AZURE_SQLVM("AzureSQLVM"), + + /** + * Enum value AzureSQLManagedInstance. + */ + AZURE_SQLMANAGED_INSTANCE("AzureSQLManagedInstance"), + + /** + * Enum value Unknown. + */ + UNKNOWN("Unknown"); + + /** + * The actual serialized value for a ReplicationPartnerType instance. + */ + private final String value; + + ReplicationPartnerType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ReplicationPartnerType instance. + * + * @param value the serialized value to parse. + * @return the parsed ReplicationPartnerType object, or null if unable to parse. + */ + public static ReplicationPartnerType fromString(String value) { + if (value == null) { + return null; + } + ReplicationPartnerType[] items = ReplicationPartnerType.values(); + for (ReplicationPartnerType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Result.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Result.java new file mode 100644 index 000000000000..e3e24924bf94 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Result.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The result of the sequencer action. + */ +public final class Result extends ExpandableStringEnum { + /** + * Static value NotCompleted for Result. + */ + public static final Result NOT_COMPLETED = fromString("NotCompleted"); + + /** + * Static value Succeeded for Result. + */ + public static final Result SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for Result. + */ + public static final Result FAILED = fromString("Failed"); + + /** + * Static value TimedOut for Result. + */ + public static final Result TIMED_OUT = fromString("TimedOut"); + + /** + * Static value Skipped for Result. + */ + public static final Result SKIPPED = fromString("Skipped"); + + /** + * Creates a new instance of Result value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Result() { + } + + /** + * Creates or finds a Result from its string representation. + * + * @param name a name to look for. + * @return the corresponding Result. + */ + public static Result fromString(String name) { + return fromString(name, Result.class); + } + + /** + * Gets known Result values. + * + * @return known Result values. + */ + public static Collection values() { + return values(Result.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Role.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Role.java new file mode 100644 index 000000000000..5c08134dc6f6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Role.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Mirroring Role. + */ +public final class Role extends ExpandableStringEnum { + /** + * Static value NONE for Role. + */ + public static final Role NONE = fromString("NONE"); + + /** + * Static value PARTNER for Role. + */ + public static final Role PARTNER = fromString("PARTNER"); + + /** + * Static value WITNESS for Role. + */ + public static final Role WITNESS = fromString("WITNESS"); + + /** + * Static value ALL for Role. + */ + public static final Role ALL = fromString("ALL"); + + /** + * Creates a new instance of Role value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Role() { + } + + /** + * Creates or finds a Role from its string representation. + * + * @param name a name to look for. + * @return the corresponding Role. + */ + public static Role fromString(String name) { + return fromString(name, Role.class); + } + + /** + * Gets known Role values. + * + * @return known Role values. + */ + public static Collection values() { + return values(Role.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ScopeType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ScopeType.java new file mode 100644 index 000000000000..4fd67ea8ddf3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ScopeType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Azure scope to which the license will apply. + */ +public final class ScopeType extends ExpandableStringEnum { + /** + * Static value Tenant for ScopeType. + */ + public static final ScopeType TENANT = fromString("Tenant"); + + /** + * Static value Subscription for ScopeType. + */ + public static final ScopeType SUBSCRIPTION = fromString("Subscription"); + + /** + * Static value ResourceGroup for ScopeType. + */ + public static final ScopeType RESOURCE_GROUP = fromString("ResourceGroup"); + + /** + * Creates a new instance of ScopeType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ScopeType() { + } + + /** + * Creates or finds a ScopeType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ScopeType. + */ + public static ScopeType fromString(String name) { + return fromString(name, ScopeType.class); + } + + /** + * Gets known ScopeType values. + * + * @return known ScopeType values. + */ + public static Collection values() { + return values(ScopeType.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SecondaryAllowConnections.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SecondaryAllowConnections.java new file mode 100644 index 000000000000..41172d2fcd39 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SecondaryAllowConnections.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * Whether the secondary replica should allow all connections, no connections, or only ReadOnly connections. + */ +public enum SecondaryAllowConnections { + /** + * Enum value NO. + */ + NO("NO"), + + /** + * Enum value ALL. + */ + ALL("ALL"), + + /** + * Enum value READ_ONLY. + */ + READ_ONLY("READ_ONLY"); + + /** + * The actual serialized value for a SecondaryAllowConnections instance. + */ + private final String value; + + SecondaryAllowConnections(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecondaryAllowConnections instance. + * + * @param value the serialized value to parse. + * @return the parsed SecondaryAllowConnections object, or null if unable to parse. + */ + public static SecondaryAllowConnections fromString(String value) { + if (value == null) { + return null; + } + SecondaryAllowConnections[] items = SecondaryAllowConnections.values(); + for (SecondaryAllowConnections item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SeedingMode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SeedingMode.java new file mode 100644 index 000000000000..7200855fa8d3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SeedingMode.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * Specifies how the secondary replica will be initially seeded. AUTOMATIC enables direct seeding. This method will seed + * the secondary replica over the network. This method does not require you to backup and restore a copy of the primary + * database on the replica. MANUAL specifies manual seeding (default). This method requires you to create a backup of + * the database on the primary replica and manually restore that backup on the secondary replica. + */ +public enum SeedingMode { + /** + * Enum value AUTOMATIC. + */ + AUTOMATIC("AUTOMATIC"), + + /** + * Enum value MANUAL. + */ + MANUAL("MANUAL"); + + /** + * The actual serialized value for a SeedingMode instance. + */ + private final String value; + + SeedingMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SeedingMode instance. + * + * @param value the serialized value to parse. + * @return the parsed SeedingMode object, or null if unable to parse. + */ + public static SeedingMode fromString(String value) { + if (value == null) { + return null; + } + SeedingMode[] items = SeedingMode.values(); + for (SeedingMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SequencerAction.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SequencerAction.java new file mode 100644 index 000000000000..f3248c580ccf --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SequencerAction.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The sequencer action details. + */ +@Fluent +public final class SequencerAction implements JsonSerializable { + /* + * The unique identifier of the sequencer action. + */ + private String actionId; + + /* + * The state of the sequencer action. + */ + private SequencerState state; + + /* + * The result of the sequencer action. + */ + private Result result; + + /** + * Creates an instance of SequencerAction class. + */ + public SequencerAction() { + } + + /** + * Get the actionId property: The unique identifier of the sequencer action. + * + * @return the actionId value. + */ + public String actionId() { + return this.actionId; + } + + /** + * Set the actionId property: The unique identifier of the sequencer action. + * + * @param actionId the actionId value to set. + * @return the SequencerAction object itself. + */ + public SequencerAction withActionId(String actionId) { + this.actionId = actionId; + return this; + } + + /** + * Get the state property: The state of the sequencer action. + * + * @return the state value. + */ + public SequencerState state() { + return this.state; + } + + /** + * Set the state property: The state of the sequencer action. + * + * @param state the state value to set. + * @return the SequencerAction object itself. + */ + public SequencerAction withState(SequencerState state) { + this.state = state; + return this; + } + + /** + * Get the result property: The result of the sequencer action. + * + * @return the result value. + */ + public Result result() { + return this.result; + } + + /** + * Set the result property: The result of the sequencer action. + * + * @param result the result value to set. + * @return the SequencerAction object itself. + */ + public SequencerAction withResult(Result result) { + this.result = result; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("actionId", this.actionId); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeStringField("result", this.result == null ? null : this.result.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SequencerAction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SequencerAction if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SequencerAction. + */ + public static SequencerAction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SequencerAction deserializedSequencerAction = new SequencerAction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("actionId".equals(fieldName)) { + deserializedSequencerAction.actionId = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedSequencerAction.state = SequencerState.fromString(reader.getString()); + } else if ("result".equals(fieldName)) { + deserializedSequencerAction.result = Result.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSequencerAction; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SequencerState.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SequencerState.java new file mode 100644 index 000000000000..9f2d6f5db1c2 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SequencerState.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The state of the sequencer action. + */ +public final class SequencerState extends ExpandableStringEnum { + /** + * Static value NotStarted for SequencerState. + */ + public static final SequencerState NOT_STARTED = fromString("NotStarted"); + + /** + * Static value WaitingPredecessors for SequencerState. + */ + public static final SequencerState WAITING_PREDECESSORS = fromString("WaitingPredecessors"); + + /** + * Static value ExecutingAction for SequencerState. + */ + public static final SequencerState EXECUTING_ACTION = fromString("ExecutingAction"); + + /** + * Static value CreatingSuccessors for SequencerState. + */ + public static final SequencerState CREATING_SUCCESSORS = fromString("CreatingSuccessors"); + + /** + * Static value Completed for SequencerState. + */ + public static final SequencerState COMPLETED = fromString("Completed"); + + /** + * Creates a new instance of SequencerState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SequencerState() { + } + + /** + * Creates or finds a SequencerState from its string representation. + * + * @param name a name to look for. + * @return the corresponding SequencerState. + */ + public static SequencerState fromString(String name) { + return fromString(name, SequencerState.class); + } + + /** + * Gets known SequencerState values. + * + * @return known SequencerState values. + */ + public static Collection values() { + return values(SequencerState.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServerAssessmentsItem.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServerAssessmentsItem.java new file mode 100644 index 000000000000..c5fdc2c15565 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServerAssessmentsItem.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The ServerAssessmentsItem model. + */ +@Fluent +public final class ServerAssessmentsItem implements JsonSerializable { + /* + * The appliesToMigrationTargetPlatform property. + */ + private String appliesToMigrationTargetPlatform; + + /* + * The featureId property. + */ + private String featureId; + + /* + * The impactedObjects property. + */ + private List impactedObjects; + + /* + * The issueCategory property. + */ + private String issueCategory; + + /* + * The moreInformation property. + */ + private String moreInformation; + + /** + * Creates an instance of ServerAssessmentsItem class. + */ + public ServerAssessmentsItem() { + } + + /** + * Get the appliesToMigrationTargetPlatform property: The appliesToMigrationTargetPlatform property. + * + * @return the appliesToMigrationTargetPlatform value. + */ + public String appliesToMigrationTargetPlatform() { + return this.appliesToMigrationTargetPlatform; + } + + /** + * Set the appliesToMigrationTargetPlatform property: The appliesToMigrationTargetPlatform property. + * + * @param appliesToMigrationTargetPlatform the appliesToMigrationTargetPlatform value to set. + * @return the ServerAssessmentsItem object itself. + */ + public ServerAssessmentsItem withAppliesToMigrationTargetPlatform(String appliesToMigrationTargetPlatform) { + this.appliesToMigrationTargetPlatform = appliesToMigrationTargetPlatform; + return this; + } + + /** + * Get the featureId property: The featureId property. + * + * @return the featureId value. + */ + public String featureId() { + return this.featureId; + } + + /** + * Set the featureId property: The featureId property. + * + * @param featureId the featureId value to set. + * @return the ServerAssessmentsItem object itself. + */ + public ServerAssessmentsItem withFeatureId(String featureId) { + this.featureId = featureId; + return this; + } + + /** + * Get the impactedObjects property: The impactedObjects property. + * + * @return the impactedObjects value. + */ + public List impactedObjects() { + return this.impactedObjects; + } + + /** + * Set the impactedObjects property: The impactedObjects property. + * + * @param impactedObjects the impactedObjects value to set. + * @return the ServerAssessmentsItem object itself. + */ + public ServerAssessmentsItem withImpactedObjects(List impactedObjects) { + this.impactedObjects = impactedObjects; + return this; + } + + /** + * Get the issueCategory property: The issueCategory property. + * + * @return the issueCategory value. + */ + public String issueCategory() { + return this.issueCategory; + } + + /** + * Set the issueCategory property: The issueCategory property. + * + * @param issueCategory the issueCategory value to set. + * @return the ServerAssessmentsItem object itself. + */ + public ServerAssessmentsItem withIssueCategory(String issueCategory) { + this.issueCategory = issueCategory; + return this; + } + + /** + * Get the moreInformation property: The moreInformation property. + * + * @return the moreInformation value. + */ + public String moreInformation() { + return this.moreInformation; + } + + /** + * Set the moreInformation property: The moreInformation property. + * + * @param moreInformation the moreInformation value to set. + * @return the ServerAssessmentsItem object itself. + */ + public ServerAssessmentsItem withMoreInformation(String moreInformation) { + this.moreInformation = moreInformation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (impactedObjects() != null) { + impactedObjects().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("appliesToMigrationTargetPlatform", this.appliesToMigrationTargetPlatform); + jsonWriter.writeStringField("featureId", this.featureId); + jsonWriter.writeArrayField("impactedObjects", this.impactedObjects, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("issueCategory", this.issueCategory); + jsonWriter.writeStringField("moreInformation", this.moreInformation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerAssessmentsItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerAssessmentsItem if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServerAssessmentsItem. + */ + public static ServerAssessmentsItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerAssessmentsItem deserializedServerAssessmentsItem = new ServerAssessmentsItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("appliesToMigrationTargetPlatform".equals(fieldName)) { + deserializedServerAssessmentsItem.appliesToMigrationTargetPlatform = reader.getString(); + } else if ("featureId".equals(fieldName)) { + deserializedServerAssessmentsItem.featureId = reader.getString(); + } else if ("impactedObjects".equals(fieldName)) { + List impactedObjects + = reader.readArray(reader1 -> ServerAssessmentsPropertiesItemsItem.fromJson(reader1)); + deserializedServerAssessmentsItem.impactedObjects = impactedObjects; + } else if ("issueCategory".equals(fieldName)) { + deserializedServerAssessmentsItem.issueCategory = reader.getString(); + } else if ("moreInformation".equals(fieldName)) { + deserializedServerAssessmentsItem.moreInformation = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedServerAssessmentsItem; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServerAssessmentsPropertiesItemsItem.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServerAssessmentsPropertiesItemsItem.java new file mode 100644 index 000000000000..75b45effa5bd --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServerAssessmentsPropertiesItemsItem.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ServerAssessmentsPropertiesItemsItem model. + */ +@Fluent +public final class ServerAssessmentsPropertiesItemsItem + implements JsonSerializable { + /* + * The impactDetail property. + */ + private String impactDetail; + + /* + * The name property. + */ + private String name; + + /* + * The objectType property. + */ + private String objectType; + + /** + * Creates an instance of ServerAssessmentsPropertiesItemsItem class. + */ + public ServerAssessmentsPropertiesItemsItem() { + } + + /** + * Get the impactDetail property: The impactDetail property. + * + * @return the impactDetail value. + */ + public String impactDetail() { + return this.impactDetail; + } + + /** + * Set the impactDetail property: The impactDetail property. + * + * @param impactDetail the impactDetail value to set. + * @return the ServerAssessmentsPropertiesItemsItem object itself. + */ + public ServerAssessmentsPropertiesItemsItem withImpactDetail(String impactDetail) { + this.impactDetail = impactDetail; + return this; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the ServerAssessmentsPropertiesItemsItem object itself. + */ + public ServerAssessmentsPropertiesItemsItem withName(String name) { + this.name = name; + return this; + } + + /** + * Get the objectType property: The objectType property. + * + * @return the objectType value. + */ + public String objectType() { + return this.objectType; + } + + /** + * Set the objectType property: The objectType property. + * + * @param objectType the objectType value to set. + * @return the ServerAssessmentsPropertiesItemsItem object itself. + */ + public ServerAssessmentsPropertiesItemsItem withObjectType(String objectType) { + this.objectType = objectType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("impactDetail", this.impactDetail); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerAssessmentsPropertiesItemsItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerAssessmentsPropertiesItemsItem if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServerAssessmentsPropertiesItemsItem. + */ + public static ServerAssessmentsPropertiesItemsItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerAssessmentsPropertiesItemsItem deserializedServerAssessmentsPropertiesItemsItem + = new ServerAssessmentsPropertiesItemsItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("impactDetail".equals(fieldName)) { + deserializedServerAssessmentsPropertiesItemsItem.impactDetail = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedServerAssessmentsPropertiesItemsItem.name = reader.getString(); + } else if ("objectType".equals(fieldName)) { + deserializedServerAssessmentsPropertiesItemsItem.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedServerAssessmentsPropertiesItemsItem; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServiceType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServiceType.java new file mode 100644 index 000000000000..72b3595cfb16 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServiceType.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Indicates if the resource represents a SQL Server engine or a SQL Server component service installed on the host. + */ +public final class ServiceType extends ExpandableStringEnum { + /** + * Static value Engine for ServiceType. + */ + public static final ServiceType ENGINE = fromString("Engine"); + + /** + * Static value SSRS for ServiceType. + */ + public static final ServiceType SSRS = fromString("SSRS"); + + /** + * Static value SSAS for ServiceType. + */ + public static final ServiceType SSAS = fromString("SSAS"); + + /** + * Static value SSIS for ServiceType. + */ + public static final ServiceType SSIS = fromString("SSIS"); + + /** + * Static value PBIRS for ServiceType. + */ + public static final ServiceType PBIRS = fromString("PBIRS"); + + /** + * Creates a new instance of ServiceType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ServiceType() { + } + + /** + * Creates or finds a ServiceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServiceType. + */ + public static ServiceType fromString(String name) { + return fromString(name, ServiceType.class); + } + + /** + * Gets known ServiceType values. + * + * @return known ServiceType values. + */ + public static Collection values() { + return values(ServiceType.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResults.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResults.java new file mode 100644 index 000000000000..f5b661b89b7d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResults.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * SKU Recommendation results for Azure migration targets for SQL Server. + */ +@Fluent +public final class SkuRecommendationResults implements JsonSerializable { + /* + * SKU Recommendation results for Azure SQL Database. + */ + private SkuRecommendationResultsAzureSqlDatabase azureSqlDatabase; + + /* + * SKU Recommendation results for Azure SQL Managed Instance. + */ + private SkuRecommendationResultsAzureSqlManagedInstance azureSqlManagedInstance; + + /* + * SKU Recommendation results for Azure SQL Virtual Machine. + */ + private SkuRecommendationResultsAzureSqlVirtualMachine azureSqlVirtualMachine; + + /** + * Creates an instance of SkuRecommendationResults class. + */ + public SkuRecommendationResults() { + } + + /** + * Get the azureSqlDatabase property: SKU Recommendation results for Azure SQL Database. + * + * @return the azureSqlDatabase value. + */ + public SkuRecommendationResultsAzureSqlDatabase azureSqlDatabase() { + return this.azureSqlDatabase; + } + + /** + * Set the azureSqlDatabase property: SKU Recommendation results for Azure SQL Database. + * + * @param azureSqlDatabase the azureSqlDatabase value to set. + * @return the SkuRecommendationResults object itself. + */ + public SkuRecommendationResults withAzureSqlDatabase(SkuRecommendationResultsAzureSqlDatabase azureSqlDatabase) { + this.azureSqlDatabase = azureSqlDatabase; + return this; + } + + /** + * Get the azureSqlManagedInstance property: SKU Recommendation results for Azure SQL Managed Instance. + * + * @return the azureSqlManagedInstance value. + */ + public SkuRecommendationResultsAzureSqlManagedInstance azureSqlManagedInstance() { + return this.azureSqlManagedInstance; + } + + /** + * Set the azureSqlManagedInstance property: SKU Recommendation results for Azure SQL Managed Instance. + * + * @param azureSqlManagedInstance the azureSqlManagedInstance value to set. + * @return the SkuRecommendationResults object itself. + */ + public SkuRecommendationResults + withAzureSqlManagedInstance(SkuRecommendationResultsAzureSqlManagedInstance azureSqlManagedInstance) { + this.azureSqlManagedInstance = azureSqlManagedInstance; + return this; + } + + /** + * Get the azureSqlVirtualMachine property: SKU Recommendation results for Azure SQL Virtual Machine. + * + * @return the azureSqlVirtualMachine value. + */ + public SkuRecommendationResultsAzureSqlVirtualMachine azureSqlVirtualMachine() { + return this.azureSqlVirtualMachine; + } + + /** + * Set the azureSqlVirtualMachine property: SKU Recommendation results for Azure SQL Virtual Machine. + * + * @param azureSqlVirtualMachine the azureSqlVirtualMachine value to set. + * @return the SkuRecommendationResults object itself. + */ + public SkuRecommendationResults + withAzureSqlVirtualMachine(SkuRecommendationResultsAzureSqlVirtualMachine azureSqlVirtualMachine) { + this.azureSqlVirtualMachine = azureSqlVirtualMachine; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (azureSqlDatabase() != null) { + azureSqlDatabase().validate(); + } + if (azureSqlManagedInstance() != null) { + azureSqlManagedInstance().validate(); + } + if (azureSqlVirtualMachine() != null) { + azureSqlVirtualMachine().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("azureSqlDatabase", this.azureSqlDatabase); + jsonWriter.writeJsonField("azureSqlManagedInstance", this.azureSqlManagedInstance); + jsonWriter.writeJsonField("azureSqlVirtualMachine", this.azureSqlVirtualMachine); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResults from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResults if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationResults. + */ + public static SkuRecommendationResults fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResults deserializedSkuRecommendationResults = new SkuRecommendationResults(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureSqlDatabase".equals(fieldName)) { + deserializedSkuRecommendationResults.azureSqlDatabase + = SkuRecommendationResultsAzureSqlDatabase.fromJson(reader); + } else if ("azureSqlManagedInstance".equals(fieldName)) { + deserializedSkuRecommendationResults.azureSqlManagedInstance + = SkuRecommendationResultsAzureSqlManagedInstance.fromJson(reader); + } else if ("azureSqlVirtualMachine".equals(fieldName)) { + deserializedSkuRecommendationResults.azureSqlVirtualMachine + = SkuRecommendationResultsAzureSqlVirtualMachine.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResults; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabase.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabase.java new file mode 100644 index 000000000000..23a66756c725 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabase.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.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * SKU Recommendation results for Azure SQL Database. + */ +@Fluent +public final class SkuRecommendationResultsAzureSqlDatabase + implements JsonSerializable { + /* + * The target recommendation Status for this database. + */ + private RecommendationStatus recommendationStatus; + + /* + * Number of blocker issues to fix before migrating to the target platform. + */ + private Integer numberOfServerBlockerIssues; + + /* + * The Monthly cost of the particular SKU. + */ + private SkuRecommendationResultsMonthlyCost monthlyCost; + + /* + * The targetSku property. + */ + private SkuRecommendationResultsAzureSqlDatabaseTargetSku targetSku; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlDatabase class. + */ + public SkuRecommendationResultsAzureSqlDatabase() { + } + + /** + * Get the recommendationStatus property: The target recommendation Status for this database. + * + * @return the recommendationStatus value. + */ + public RecommendationStatus recommendationStatus() { + return this.recommendationStatus; + } + + /** + * Set the recommendationStatus property: The target recommendation Status for this database. + * + * @param recommendationStatus the recommendationStatus value to set. + * @return the SkuRecommendationResultsAzureSqlDatabase object itself. + */ + public SkuRecommendationResultsAzureSqlDatabase + withRecommendationStatus(RecommendationStatus recommendationStatus) { + this.recommendationStatus = recommendationStatus; + return this; + } + + /** + * Get the numberOfServerBlockerIssues property: Number of blocker issues to fix before migrating to the target + * platform. + * + * @return the numberOfServerBlockerIssues value. + */ + public Integer numberOfServerBlockerIssues() { + return this.numberOfServerBlockerIssues; + } + + /** + * Set the numberOfServerBlockerIssues property: Number of blocker issues to fix before migrating to the target + * platform. + * + * @param numberOfServerBlockerIssues the numberOfServerBlockerIssues value to set. + * @return the SkuRecommendationResultsAzureSqlDatabase object itself. + */ + public SkuRecommendationResultsAzureSqlDatabase + withNumberOfServerBlockerIssues(Integer numberOfServerBlockerIssues) { + this.numberOfServerBlockerIssues = numberOfServerBlockerIssues; + return this; + } + + /** + * Get the monthlyCost property: The Monthly cost of the particular SKU. + * + * @return the monthlyCost value. + */ + public SkuRecommendationResultsMonthlyCost monthlyCost() { + return this.monthlyCost; + } + + /** + * Set the monthlyCost property: The Monthly cost of the particular SKU. + * + * @param monthlyCost the monthlyCost value to set. + * @return the SkuRecommendationResultsAzureSqlDatabase object itself. + */ + public SkuRecommendationResultsAzureSqlDatabase withMonthlyCost(SkuRecommendationResultsMonthlyCost monthlyCost) { + this.monthlyCost = monthlyCost; + return this; + } + + /** + * Get the targetSku property: The targetSku property. + * + * @return the targetSku value. + */ + public SkuRecommendationResultsAzureSqlDatabaseTargetSku targetSku() { + return this.targetSku; + } + + /** + * Set the targetSku property: The targetSku property. + * + * @param targetSku the targetSku value to set. + * @return the SkuRecommendationResultsAzureSqlDatabase object itself. + */ + public SkuRecommendationResultsAzureSqlDatabase + withTargetSku(SkuRecommendationResultsAzureSqlDatabaseTargetSku targetSku) { + this.targetSku = targetSku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (monthlyCost() != null) { + monthlyCost().validate(); + } + if (targetSku() != null) { + targetSku().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recommendationStatus", + this.recommendationStatus == null ? null : this.recommendationStatus.toString()); + jsonWriter.writeNumberField("numberOfServerBlockerIssues", this.numberOfServerBlockerIssues); + jsonWriter.writeJsonField("monthlyCost", this.monthlyCost); + jsonWriter.writeJsonField("targetSku", this.targetSku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlDatabase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlDatabase if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationResultsAzureSqlDatabase. + */ + public static SkuRecommendationResultsAzureSqlDatabase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlDatabase deserializedSkuRecommendationResultsAzureSqlDatabase + = new SkuRecommendationResultsAzureSqlDatabase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recommendationStatus".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabase.recommendationStatus + = RecommendationStatus.fromString(reader.getString()); + } else if ("numberOfServerBlockerIssues".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabase.numberOfServerBlockerIssues + = reader.getNullable(JsonReader::getInt); + } else if ("monthlyCost".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabase.monthlyCost + = SkuRecommendationResultsMonthlyCost.fromJson(reader); + } else if ("targetSku".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabase.targetSku + = SkuRecommendationResultsAzureSqlDatabaseTargetSku.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlDatabase; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabaseTargetSku.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabaseTargetSku.java new file mode 100644 index 000000000000..f1c06a01f831 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabaseTargetSku.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SkuRecommendationResultsAzureSqlDatabaseTargetSku model. + */ +@Fluent +public final class SkuRecommendationResultsAzureSqlDatabaseTargetSku + implements JsonSerializable { + /* + * The category property. + */ + private SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory category; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlDatabaseTargetSku class. + */ + public SkuRecommendationResultsAzureSqlDatabaseTargetSku() { + } + + /** + * Get the category property: The category property. + * + * @return the category value. + */ + public SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory category() { + return this.category; + } + + /** + * Set the category property: The category property. + * + * @param category the category value to set. + * @return the SkuRecommendationResultsAzureSqlDatabaseTargetSku object itself. + */ + public SkuRecommendationResultsAzureSqlDatabaseTargetSku + withCategory(SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory category) { + this.category = category; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (category() != null) { + category().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("category", this.category); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlDatabaseTargetSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlDatabaseTargetSku if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationResultsAzureSqlDatabaseTargetSku. + */ + public static SkuRecommendationResultsAzureSqlDatabaseTargetSku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlDatabaseTargetSku deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSku + = new SkuRecommendationResultsAzureSqlDatabaseTargetSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("category".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSku.category + = SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSku; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.java new file mode 100644 index 000000000000..98d5f93bd575 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory model. + */ +@Fluent +public final class SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory + implements JsonSerializable { + /* + * The compute tier of the target SKU. + */ + private String computeTier; + + /* + * The hardware type of the target SKU. + */ + private String hardwareType; + + /* + * The SQL purchasing model of the target SKU. + */ + private String sqlPurchasingModel; + + /* + * The SQL service tier of the target SKU. + */ + private String sqlServiceTier; + + /* + * Indicates if zone redundancy is available for the target SKU. + */ + private Boolean zoneRedundancyAvailable; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory class. + */ + public SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory() { + } + + /** + * Get the computeTier property: The compute tier of the target SKU. + * + * @return the computeTier value. + */ + public String computeTier() { + return this.computeTier; + } + + /** + * Set the computeTier property: The compute tier of the target SKU. + * + * @param computeTier the computeTier value to set. + * @return the SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory object itself. + */ + public SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory withComputeTier(String computeTier) { + this.computeTier = computeTier; + return this; + } + + /** + * Get the hardwareType property: The hardware type of the target SKU. + * + * @return the hardwareType value. + */ + public String hardwareType() { + return this.hardwareType; + } + + /** + * Set the hardwareType property: The hardware type of the target SKU. + * + * @param hardwareType the hardwareType value to set. + * @return the SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory object itself. + */ + public SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory withHardwareType(String hardwareType) { + this.hardwareType = hardwareType; + return this; + } + + /** + * Get the sqlPurchasingModel property: The SQL purchasing model of the target SKU. + * + * @return the sqlPurchasingModel value. + */ + public String sqlPurchasingModel() { + return this.sqlPurchasingModel; + } + + /** + * Set the sqlPurchasingModel property: The SQL purchasing model of the target SKU. + * + * @param sqlPurchasingModel the sqlPurchasingModel value to set. + * @return the SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory object itself. + */ + public SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory withSqlPurchasingModel(String sqlPurchasingModel) { + this.sqlPurchasingModel = sqlPurchasingModel; + return this; + } + + /** + * Get the sqlServiceTier property: The SQL service tier of the target SKU. + * + * @return the sqlServiceTier value. + */ + public String sqlServiceTier() { + return this.sqlServiceTier; + } + + /** + * Set the sqlServiceTier property: The SQL service tier of the target SKU. + * + * @param sqlServiceTier the sqlServiceTier value to set. + * @return the SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory object itself. + */ + public SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory withSqlServiceTier(String sqlServiceTier) { + this.sqlServiceTier = sqlServiceTier; + return this; + } + + /** + * Get the zoneRedundancyAvailable property: Indicates if zone redundancy is available for the target SKU. + * + * @return the zoneRedundancyAvailable value. + */ + public Boolean zoneRedundancyAvailable() { + return this.zoneRedundancyAvailable; + } + + /** + * Set the zoneRedundancyAvailable property: Indicates if zone redundancy is available for the target SKU. + * + * @param zoneRedundancyAvailable the zoneRedundancyAvailable value to set. + * @return the SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory object itself. + */ + public SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory + withZoneRedundancyAvailable(Boolean zoneRedundancyAvailable) { + this.zoneRedundancyAvailable = zoneRedundancyAvailable; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("computeTier", this.computeTier); + jsonWriter.writeStringField("hardwareType", this.hardwareType); + jsonWriter.writeStringField("sqlPurchasingModel", this.sqlPurchasingModel); + jsonWriter.writeStringField("sqlServiceTier", this.sqlServiceTier); + jsonWriter.writeBooleanField("zoneRedundancyAvailable", this.zoneRedundancyAvailable); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory if the JsonReader was pointing + * to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory. + */ + public static SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory + = new SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("computeTier".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.computeTier + = reader.getString(); + } else if ("hardwareType".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.hardwareType + = reader.getString(); + } else if ("sqlPurchasingModel".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.sqlPurchasingModel + = reader.getString(); + } else if ("sqlServiceTier".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.sqlServiceTier + = reader.getString(); + } else if ("zoneRedundancyAvailable".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.zoneRedundancyAvailable + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstance.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstance.java new file mode 100644 index 000000000000..86805f778126 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstance.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * SKU Recommendation results for Azure SQL Managed Instance. + */ +@Fluent +public final class SkuRecommendationResultsAzureSqlManagedInstance + implements JsonSerializable { + /* + * The target recommendation Status for this database. + */ + private RecommendationStatus recommendationStatus; + + /* + * Number of blocker issues to fix before migrating to the target platform. + */ + private Integer numberOfServerBlockerIssues; + + /* + * The Monthly cost of the particular SKU. + */ + private SkuRecommendationResultsMonthlyCost monthlyCost; + + /* + * The targetSku property. + */ + private SkuRecommendationResultsAzureSqlManagedInstanceTargetSku targetSku; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlManagedInstance class. + */ + public SkuRecommendationResultsAzureSqlManagedInstance() { + } + + /** + * Get the recommendationStatus property: The target recommendation Status for this database. + * + * @return the recommendationStatus value. + */ + public RecommendationStatus recommendationStatus() { + return this.recommendationStatus; + } + + /** + * Set the recommendationStatus property: The target recommendation Status for this database. + * + * @param recommendationStatus the recommendationStatus value to set. + * @return the SkuRecommendationResultsAzureSqlManagedInstance object itself. + */ + public SkuRecommendationResultsAzureSqlManagedInstance + withRecommendationStatus(RecommendationStatus recommendationStatus) { + this.recommendationStatus = recommendationStatus; + return this; + } + + /** + * Get the numberOfServerBlockerIssues property: Number of blocker issues to fix before migrating to the target + * platform. + * + * @return the numberOfServerBlockerIssues value. + */ + public Integer numberOfServerBlockerIssues() { + return this.numberOfServerBlockerIssues; + } + + /** + * Set the numberOfServerBlockerIssues property: Number of blocker issues to fix before migrating to the target + * platform. + * + * @param numberOfServerBlockerIssues the numberOfServerBlockerIssues value to set. + * @return the SkuRecommendationResultsAzureSqlManagedInstance object itself. + */ + public SkuRecommendationResultsAzureSqlManagedInstance + withNumberOfServerBlockerIssues(Integer numberOfServerBlockerIssues) { + this.numberOfServerBlockerIssues = numberOfServerBlockerIssues; + return this; + } + + /** + * Get the monthlyCost property: The Monthly cost of the particular SKU. + * + * @return the monthlyCost value. + */ + public SkuRecommendationResultsMonthlyCost monthlyCost() { + return this.monthlyCost; + } + + /** + * Set the monthlyCost property: The Monthly cost of the particular SKU. + * + * @param monthlyCost the monthlyCost value to set. + * @return the SkuRecommendationResultsAzureSqlManagedInstance object itself. + */ + public SkuRecommendationResultsAzureSqlManagedInstance + withMonthlyCost(SkuRecommendationResultsMonthlyCost monthlyCost) { + this.monthlyCost = monthlyCost; + return this; + } + + /** + * Get the targetSku property: The targetSku property. + * + * @return the targetSku value. + */ + public SkuRecommendationResultsAzureSqlManagedInstanceTargetSku targetSku() { + return this.targetSku; + } + + /** + * Set the targetSku property: The targetSku property. + * + * @param targetSku the targetSku value to set. + * @return the SkuRecommendationResultsAzureSqlManagedInstance object itself. + */ + public SkuRecommendationResultsAzureSqlManagedInstance + withTargetSku(SkuRecommendationResultsAzureSqlManagedInstanceTargetSku targetSku) { + this.targetSku = targetSku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (monthlyCost() != null) { + monthlyCost().validate(); + } + if (targetSku() != null) { + targetSku().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recommendationStatus", + this.recommendationStatus == null ? null : this.recommendationStatus.toString()); + jsonWriter.writeNumberField("numberOfServerBlockerIssues", this.numberOfServerBlockerIssues); + jsonWriter.writeJsonField("monthlyCost", this.monthlyCost); + jsonWriter.writeJsonField("targetSku", this.targetSku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlManagedInstance from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlManagedInstance if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationResultsAzureSqlManagedInstance. + */ + public static SkuRecommendationResultsAzureSqlManagedInstance fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlManagedInstance deserializedSkuRecommendationResultsAzureSqlManagedInstance + = new SkuRecommendationResultsAzureSqlManagedInstance(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recommendationStatus".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstance.recommendationStatus + = RecommendationStatus.fromString(reader.getString()); + } else if ("numberOfServerBlockerIssues".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstance.numberOfServerBlockerIssues + = reader.getNullable(JsonReader::getInt); + } else if ("monthlyCost".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstance.monthlyCost + = SkuRecommendationResultsMonthlyCost.fromJson(reader); + } else if ("targetSku".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstance.targetSku + = SkuRecommendationResultsAzureSqlManagedInstanceTargetSku.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlManagedInstance; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstanceTargetSku.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstanceTargetSku.java new file mode 100644 index 000000000000..38b5dec132fa --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstanceTargetSku.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.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SkuRecommendationResultsAzureSqlManagedInstanceTargetSku model. + */ +@Fluent +public final class SkuRecommendationResultsAzureSqlManagedInstanceTargetSku + implements JsonSerializable { + /* + * The category property. + */ + private SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory category; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlManagedInstanceTargetSku class. + */ + public SkuRecommendationResultsAzureSqlManagedInstanceTargetSku() { + } + + /** + * Get the category property: The category property. + * + * @return the category value. + */ + public SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory category() { + return this.category; + } + + /** + * Set the category property: The category property. + * + * @param category the category value to set. + * @return the SkuRecommendationResultsAzureSqlManagedInstanceTargetSku object itself. + */ + public SkuRecommendationResultsAzureSqlManagedInstanceTargetSku + withCategory(SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory category) { + this.category = category; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (category() != null) { + category().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("category", this.category); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlManagedInstanceTargetSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlManagedInstanceTargetSku if the JsonReader was pointing to + * an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * SkuRecommendationResultsAzureSqlManagedInstanceTargetSku. + */ + public static SkuRecommendationResultsAzureSqlManagedInstanceTargetSku fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlManagedInstanceTargetSku deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSku + = new SkuRecommendationResultsAzureSqlManagedInstanceTargetSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("category".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSku.category + = SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSku; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.java new file mode 100644 index 000000000000..587414940510 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.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.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory model. + */ +@Fluent +public final class SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory + implements JsonSerializable { + /* + * The compute tier of the target SKU. + */ + private String computeTier; + + /* + * The hardware type of the target SKU. + */ + private String hardwareType; + + /* + * The SQL purchasing model of the target SKU. + */ + private String sqlPurchasingModel; + + /* + * The SQL service tier of the target SKU. + */ + private String sqlServiceTier; + + /* + * Indicates if zone redundancy is available for the target SKU. + */ + private Boolean zoneRedundancyAvailable; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory class. + */ + public SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory() { + } + + /** + * Get the computeTier property: The compute tier of the target SKU. + * + * @return the computeTier value. + */ + public String computeTier() { + return this.computeTier; + } + + /** + * Set the computeTier property: The compute tier of the target SKU. + * + * @param computeTier the computeTier value to set. + * @return the SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory object itself. + */ + public SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory withComputeTier(String computeTier) { + this.computeTier = computeTier; + return this; + } + + /** + * Get the hardwareType property: The hardware type of the target SKU. + * + * @return the hardwareType value. + */ + public String hardwareType() { + return this.hardwareType; + } + + /** + * Set the hardwareType property: The hardware type of the target SKU. + * + * @param hardwareType the hardwareType value to set. + * @return the SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory object itself. + */ + public SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory withHardwareType(String hardwareType) { + this.hardwareType = hardwareType; + return this; + } + + /** + * Get the sqlPurchasingModel property: The SQL purchasing model of the target SKU. + * + * @return the sqlPurchasingModel value. + */ + public String sqlPurchasingModel() { + return this.sqlPurchasingModel; + } + + /** + * Set the sqlPurchasingModel property: The SQL purchasing model of the target SKU. + * + * @param sqlPurchasingModel the sqlPurchasingModel value to set. + * @return the SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory object itself. + */ + public SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory + withSqlPurchasingModel(String sqlPurchasingModel) { + this.sqlPurchasingModel = sqlPurchasingModel; + return this; + } + + /** + * Get the sqlServiceTier property: The SQL service tier of the target SKU. + * + * @return the sqlServiceTier value. + */ + public String sqlServiceTier() { + return this.sqlServiceTier; + } + + /** + * Set the sqlServiceTier property: The SQL service tier of the target SKU. + * + * @param sqlServiceTier the sqlServiceTier value to set. + * @return the SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory object itself. + */ + public SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory withSqlServiceTier(String sqlServiceTier) { + this.sqlServiceTier = sqlServiceTier; + return this; + } + + /** + * Get the zoneRedundancyAvailable property: Indicates if zone redundancy is available for the target SKU. + * + * @return the zoneRedundancyAvailable value. + */ + public Boolean zoneRedundancyAvailable() { + return this.zoneRedundancyAvailable; + } + + /** + * Set the zoneRedundancyAvailable property: Indicates if zone redundancy is available for the target SKU. + * + * @param zoneRedundancyAvailable the zoneRedundancyAvailable value to set. + * @return the SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory object itself. + */ + public SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory + withZoneRedundancyAvailable(Boolean zoneRedundancyAvailable) { + this.zoneRedundancyAvailable = zoneRedundancyAvailable; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("computeTier", this.computeTier); + jsonWriter.writeStringField("hardwareType", this.hardwareType); + jsonWriter.writeStringField("sqlPurchasingModel", this.sqlPurchasingModel); + jsonWriter.writeStringField("sqlServiceTier", this.sqlServiceTier); + jsonWriter.writeBooleanField("zoneRedundancyAvailable", this.zoneRedundancyAvailable); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory if the JsonReader was + * pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory. + */ + public static SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory + = new SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("computeTier".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.computeTier + = reader.getString(); + } else if ("hardwareType".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.hardwareType + = reader.getString(); + } else if ("sqlPurchasingModel".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.sqlPurchasingModel + = reader.getString(); + } else if ("sqlServiceTier".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.sqlServiceTier + = reader.getString(); + } else if ("zoneRedundancyAvailable".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.zoneRedundancyAvailable + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachine.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachine.java new file mode 100644 index 000000000000..da559d5a34f9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachine.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * SKU Recommendation results for Azure SQL Virtual Machine. + */ +@Fluent +public final class SkuRecommendationResultsAzureSqlVirtualMachine + implements JsonSerializable { + /* + * The target recommendation Status for this database. + */ + private RecommendationStatus recommendationStatus; + + /* + * Number of blocker issues to fix before migrating to the target platform. + */ + private Integer numberOfServerBlockerIssues; + + /* + * The Monthly cost of the particular SKU. + */ + private SkuRecommendationResultsMonthlyCost monthlyCost; + + /* + * The targetSku property. + */ + private SkuRecommendationResultsAzureSqlVirtualMachineTargetSku targetSku; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlVirtualMachine class. + */ + public SkuRecommendationResultsAzureSqlVirtualMachine() { + } + + /** + * Get the recommendationStatus property: The target recommendation Status for this database. + * + * @return the recommendationStatus value. + */ + public RecommendationStatus recommendationStatus() { + return this.recommendationStatus; + } + + /** + * Set the recommendationStatus property: The target recommendation Status for this database. + * + * @param recommendationStatus the recommendationStatus value to set. + * @return the SkuRecommendationResultsAzureSqlVirtualMachine object itself. + */ + public SkuRecommendationResultsAzureSqlVirtualMachine + withRecommendationStatus(RecommendationStatus recommendationStatus) { + this.recommendationStatus = recommendationStatus; + return this; + } + + /** + * Get the numberOfServerBlockerIssues property: Number of blocker issues to fix before migrating to the target + * platform. + * + * @return the numberOfServerBlockerIssues value. + */ + public Integer numberOfServerBlockerIssues() { + return this.numberOfServerBlockerIssues; + } + + /** + * Set the numberOfServerBlockerIssues property: Number of blocker issues to fix before migrating to the target + * platform. + * + * @param numberOfServerBlockerIssues the numberOfServerBlockerIssues value to set. + * @return the SkuRecommendationResultsAzureSqlVirtualMachine object itself. + */ + public SkuRecommendationResultsAzureSqlVirtualMachine + withNumberOfServerBlockerIssues(Integer numberOfServerBlockerIssues) { + this.numberOfServerBlockerIssues = numberOfServerBlockerIssues; + return this; + } + + /** + * Get the monthlyCost property: The Monthly cost of the particular SKU. + * + * @return the monthlyCost value. + */ + public SkuRecommendationResultsMonthlyCost monthlyCost() { + return this.monthlyCost; + } + + /** + * Set the monthlyCost property: The Monthly cost of the particular SKU. + * + * @param monthlyCost the monthlyCost value to set. + * @return the SkuRecommendationResultsAzureSqlVirtualMachine object itself. + */ + public SkuRecommendationResultsAzureSqlVirtualMachine + withMonthlyCost(SkuRecommendationResultsMonthlyCost monthlyCost) { + this.monthlyCost = monthlyCost; + return this; + } + + /** + * Get the targetSku property: The targetSku property. + * + * @return the targetSku value. + */ + public SkuRecommendationResultsAzureSqlVirtualMachineTargetSku targetSku() { + return this.targetSku; + } + + /** + * Set the targetSku property: The targetSku property. + * + * @param targetSku the targetSku value to set. + * @return the SkuRecommendationResultsAzureSqlVirtualMachine object itself. + */ + public SkuRecommendationResultsAzureSqlVirtualMachine + withTargetSku(SkuRecommendationResultsAzureSqlVirtualMachineTargetSku targetSku) { + this.targetSku = targetSku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (monthlyCost() != null) { + monthlyCost().validate(); + } + if (targetSku() != null) { + targetSku().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recommendationStatus", + this.recommendationStatus == null ? null : this.recommendationStatus.toString()); + jsonWriter.writeNumberField("numberOfServerBlockerIssues", this.numberOfServerBlockerIssues); + jsonWriter.writeJsonField("monthlyCost", this.monthlyCost); + jsonWriter.writeJsonField("targetSku", this.targetSku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlVirtualMachine from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlVirtualMachine if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationResultsAzureSqlVirtualMachine. + */ + public static SkuRecommendationResultsAzureSqlVirtualMachine fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlVirtualMachine deserializedSkuRecommendationResultsAzureSqlVirtualMachine + = new SkuRecommendationResultsAzureSqlVirtualMachine(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recommendationStatus".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachine.recommendationStatus + = RecommendationStatus.fromString(reader.getString()); + } else if ("numberOfServerBlockerIssues".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachine.numberOfServerBlockerIssues + = reader.getNullable(JsonReader::getInt); + } else if ("monthlyCost".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachine.monthlyCost + = SkuRecommendationResultsMonthlyCost.fromJson(reader); + } else if ("targetSku".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachine.targetSku + = SkuRecommendationResultsAzureSqlVirtualMachineTargetSku.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlVirtualMachine; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSku.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSku.java new file mode 100644 index 000000000000..e7c8e2b9b51d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSku.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.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SkuRecommendationResultsAzureSqlVirtualMachineTargetSku model. + */ +@Fluent +public final class SkuRecommendationResultsAzureSqlVirtualMachineTargetSku + implements JsonSerializable { + /* + * The category property. + */ + private SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory category; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlVirtualMachineTargetSku class. + */ + public SkuRecommendationResultsAzureSqlVirtualMachineTargetSku() { + } + + /** + * Get the category property: The category property. + * + * @return the category value. + */ + public SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory category() { + return this.category; + } + + /** + * Set the category property: The category property. + * + * @param category the category value to set. + * @return the SkuRecommendationResultsAzureSqlVirtualMachineTargetSku object itself. + */ + public SkuRecommendationResultsAzureSqlVirtualMachineTargetSku + withCategory(SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory category) { + this.category = category; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (category() != null) { + category().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("category", this.category); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlVirtualMachineTargetSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlVirtualMachineTargetSku if the JsonReader was pointing to + * an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationResultsAzureSqlVirtualMachineTargetSku. + */ + public static SkuRecommendationResultsAzureSqlVirtualMachineTargetSku fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlVirtualMachineTargetSku deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSku + = new SkuRecommendationResultsAzureSqlVirtualMachineTargetSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("category".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSku.category + = SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSku; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory.java new file mode 100644 index 000000000000..9294a9cb19e0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory model. + */ +@Fluent +public final class SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory + implements JsonSerializable { + /* + * Available VM SKUs for the Azure SQL Virtual Machine. + */ + private List availableVmSkus; + + /* + * The virtual machine family of the target SKU. + */ + private String virtualMachineFamily; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory class. + */ + public SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory() { + } + + /** + * Get the availableVmSkus property: Available VM SKUs for the Azure SQL Virtual Machine. + * + * @return the availableVmSkus value. + */ + public List availableVmSkus() { + return this.availableVmSkus; + } + + /** + * Set the availableVmSkus property: Available VM SKUs for the Azure SQL Virtual Machine. + * + * @param availableVmSkus the availableVmSkus value to set. + * @return the SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory object itself. + */ + public SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory + withAvailableVmSkus(List availableVmSkus) { + this.availableVmSkus = availableVmSkus; + return this; + } + + /** + * Get the virtualMachineFamily property: The virtual machine family of the target SKU. + * + * @return the virtualMachineFamily value. + */ + public String virtualMachineFamily() { + return this.virtualMachineFamily; + } + + /** + * Set the virtualMachineFamily property: The virtual machine family of the target SKU. + * + * @param virtualMachineFamily the virtualMachineFamily value to set. + * @return the SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory object itself. + */ + public SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory + withVirtualMachineFamily(String virtualMachineFamily) { + this.virtualMachineFamily = virtualMachineFamily; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("availableVmSkus", this.availableVmSkus, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("virtualMachineFamily", this.virtualMachineFamily); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory if the JsonReader was + * pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory. + */ + public static SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory + = new SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("availableVmSkus".equals(fieldName)) { + List availableVmSkus = reader.readArray(reader1 -> reader1.getString()); + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory.availableVmSkus + = availableVmSkus; + } else if ("virtualMachineFamily".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory.virtualMachineFamily + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsMonthlyCost.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsMonthlyCost.java new file mode 100644 index 000000000000..21a9fb55dc1d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsMonthlyCost.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.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Monthly cost of the particular SKU. + */ +@Fluent +public final class SkuRecommendationResultsMonthlyCost + implements JsonSerializable { + /* + * Represents the Cost of Compute. + */ + private Float computeCost; + + /* + * Represents the Cost of Storage. + */ + private Float storageCost; + + /* + * Represents the Total Cost. + */ + private Float totalCost; + + /** + * Creates an instance of SkuRecommendationResultsMonthlyCost class. + */ + public SkuRecommendationResultsMonthlyCost() { + } + + /** + * Get the computeCost property: Represents the Cost of Compute. + * + * @return the computeCost value. + */ + public Float computeCost() { + return this.computeCost; + } + + /** + * Set the computeCost property: Represents the Cost of Compute. + * + * @param computeCost the computeCost value to set. + * @return the SkuRecommendationResultsMonthlyCost object itself. + */ + public SkuRecommendationResultsMonthlyCost withComputeCost(Float computeCost) { + this.computeCost = computeCost; + return this; + } + + /** + * Get the storageCost property: Represents the Cost of Storage. + * + * @return the storageCost value. + */ + public Float storageCost() { + return this.storageCost; + } + + /** + * Set the storageCost property: Represents the Cost of Storage. + * + * @param storageCost the storageCost value to set. + * @return the SkuRecommendationResultsMonthlyCost object itself. + */ + public SkuRecommendationResultsMonthlyCost withStorageCost(Float storageCost) { + this.storageCost = storageCost; + return this; + } + + /** + * Get the totalCost property: Represents the Total Cost. + * + * @return the totalCost value. + */ + public Float totalCost() { + return this.totalCost; + } + + /** + * Set the totalCost property: Represents the Total Cost. + * + * @param totalCost the totalCost value to set. + * @return the SkuRecommendationResultsMonthlyCost object itself. + */ + public SkuRecommendationResultsMonthlyCost withTotalCost(Float totalCost) { + this.totalCost = totalCost; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("computeCost", this.computeCost); + jsonWriter.writeNumberField("storageCost", this.storageCost); + jsonWriter.writeNumberField("totalCost", this.totalCost); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsMonthlyCost from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsMonthlyCost if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationResultsMonthlyCost. + */ + public static SkuRecommendationResultsMonthlyCost fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsMonthlyCost deserializedSkuRecommendationResultsMonthlyCost + = new SkuRecommendationResultsMonthlyCost(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("computeCost".equals(fieldName)) { + deserializedSkuRecommendationResultsMonthlyCost.computeCost + = reader.getNullable(JsonReader::getFloat); + } else if ("storageCost".equals(fieldName)) { + deserializedSkuRecommendationResultsMonthlyCost.storageCost + = reader.getNullable(JsonReader::getFloat); + } else if ("totalCost".equals(fieldName)) { + deserializedSkuRecommendationResultsMonthlyCost.totalCost + = reader.getNullable(JsonReader::getFloat); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsMonthlyCost; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationSummary.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationSummary.java new file mode 100644 index 000000000000..db8f4bcc7abe --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationSummary.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SKU recommendation summary. + */ +@Fluent +public final class SkuRecommendationSummary implements JsonSerializable { + /* + * Number of blocker issues to fix before migrating this database to the target platform. + */ + private Integer numOfBlockerIssues; + + /* + * The target recommendation Status for this database. + */ + private RecommendationStatus recommendationStatus; + + /** + * Creates an instance of SkuRecommendationSummary class. + */ + public SkuRecommendationSummary() { + } + + /** + * Get the numOfBlockerIssues property: Number of blocker issues to fix before migrating this database to the target + * platform. + * + * @return the numOfBlockerIssues value. + */ + public Integer numOfBlockerIssues() { + return this.numOfBlockerIssues; + } + + /** + * Set the numOfBlockerIssues property: Number of blocker issues to fix before migrating this database to the target + * platform. + * + * @param numOfBlockerIssues the numOfBlockerIssues value to set. + * @return the SkuRecommendationSummary object itself. + */ + public SkuRecommendationSummary withNumOfBlockerIssues(Integer numOfBlockerIssues) { + this.numOfBlockerIssues = numOfBlockerIssues; + return this; + } + + /** + * Get the recommendationStatus property: The target recommendation Status for this database. + * + * @return the recommendationStatus value. + */ + public RecommendationStatus recommendationStatus() { + return this.recommendationStatus; + } + + /** + * Set the recommendationStatus property: The target recommendation Status for this database. + * + * @param recommendationStatus the recommendationStatus value to set. + * @return the SkuRecommendationSummary object itself. + */ + public SkuRecommendationSummary withRecommendationStatus(RecommendationStatus recommendationStatus) { + this.recommendationStatus = recommendationStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("numOfBlockerIssues", this.numOfBlockerIssues); + jsonWriter.writeStringField("recommendationStatus", + this.recommendationStatus == null ? null : this.recommendationStatus.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationSummary from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationSummary if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationSummary. + */ + public static SkuRecommendationSummary fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationSummary deserializedSkuRecommendationSummary = new SkuRecommendationSummary(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("numOfBlockerIssues".equals(fieldName)) { + deserializedSkuRecommendationSummary.numOfBlockerIssues = reader.getNullable(JsonReader::getInt); + } else if ("recommendationStatus".equals(fieldName)) { + deserializedSkuRecommendationSummary.recommendationStatus + = RecommendationStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationSummary; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseReplicaResourceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseReplicaResourceProperties.java new file mode 100644 index 000000000000..e6571510fb4c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseReplicaResourceProperties.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of Arc Sql availability group database replica resource. + */ +@Fluent +public final class SqlAvailabilityGroupDatabaseReplicaResourceProperties + implements JsonSerializable { + /* + * the database name. + */ + private String databaseName; + + /* + * the database replica name. + */ + private String replicaName; + + /* + * Whether the availability database is local. + */ + private Boolean isLocal; + + /* + * Returns 1 if the replica is primary, or 0 if it is a secondary replica. + */ + private Boolean isPrimaryReplica; + + /* + * Description of the data-movement state. + */ + private String synchronizationStateDescription; + + /* + * Whether this replica is transaction committer. + */ + private Boolean isCommitParticipant; + + /* + * Description of the health of database. + */ + private String synchronizationHealthDescription; + + /* + * Description of the database state of the availability replica. + */ + private String databaseStateDescription; + + /* + * Whether this data movement is suspended. + */ + private Boolean isSuspended; + + /* + * Description of the database suspended state reason. + */ + private String suspendReasonDescription; + + /** + * Creates an instance of SqlAvailabilityGroupDatabaseReplicaResourceProperties class. + */ + public SqlAvailabilityGroupDatabaseReplicaResourceProperties() { + } + + /** + * Get the databaseName property: the database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: the database name. + * + * @param databaseName the databaseName value to set. + * @return the SqlAvailabilityGroupDatabaseReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupDatabaseReplicaResourceProperties withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the replicaName property: the database replica name. + * + * @return the replicaName value. + */ + public String replicaName() { + return this.replicaName; + } + + /** + * Get the isLocal property: Whether the availability database is local. + * + * @return the isLocal value. + */ + public Boolean isLocal() { + return this.isLocal; + } + + /** + * Get the isPrimaryReplica property: Returns 1 if the replica is primary, or 0 if it is a secondary replica. + * + * @return the isPrimaryReplica value. + */ + public Boolean isPrimaryReplica() { + return this.isPrimaryReplica; + } + + /** + * Get the synchronizationStateDescription property: Description of the data-movement state. + * + * @return the synchronizationStateDescription value. + */ + public String synchronizationStateDescription() { + return this.synchronizationStateDescription; + } + + /** + * Get the isCommitParticipant property: Whether this replica is transaction committer. + * + * @return the isCommitParticipant value. + */ + public Boolean isCommitParticipant() { + return this.isCommitParticipant; + } + + /** + * Get the synchronizationHealthDescription property: Description of the health of database. + * + * @return the synchronizationHealthDescription value. + */ + public String synchronizationHealthDescription() { + return this.synchronizationHealthDescription; + } + + /** + * Get the databaseStateDescription property: Description of the database state of the availability replica. + * + * @return the databaseStateDescription value. + */ + public String databaseStateDescription() { + return this.databaseStateDescription; + } + + /** + * Get the isSuspended property: Whether this data movement is suspended. + * + * @return the isSuspended value. + */ + public Boolean isSuspended() { + return this.isSuspended; + } + + /** + * Get the suspendReasonDescription property: Description of the database suspended state reason. + * + * @return the suspendReasonDescription value. + */ + public String suspendReasonDescription() { + return this.suspendReasonDescription; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("databaseName", this.databaseName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlAvailabilityGroupDatabaseReplicaResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlAvailabilityGroupDatabaseReplicaResourceProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlAvailabilityGroupDatabaseReplicaResourceProperties. + */ + public static SqlAvailabilityGroupDatabaseReplicaResourceProperties fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlAvailabilityGroupDatabaseReplicaResourceProperties deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties + = new SqlAvailabilityGroupDatabaseReplicaResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("databaseName".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.databaseName = reader.getString(); + } else if ("replicaName".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.replicaName = reader.getString(); + } else if ("isLocal".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.isLocal + = reader.getNullable(JsonReader::getBoolean); + } else if ("isPrimaryReplica".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.isPrimaryReplica + = reader.getNullable(JsonReader::getBoolean); + } else if ("synchronizationStateDescription".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.synchronizationStateDescription + = reader.getString(); + } else if ("isCommitParticipant".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.isCommitParticipant + = reader.getNullable(JsonReader::getBoolean); + } else if ("synchronizationHealthDescription".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.synchronizationHealthDescription + = reader.getString(); + } else if ("databaseStateDescription".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.databaseStateDescription + = reader.getString(); + } else if ("isSuspended".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.isSuspended + = reader.getNullable(JsonReader::getBoolean); + } else if ("suspendReasonDescription".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.suspendReasonDescription + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem.java new file mode 100644 index 000000000000..f738b1edd992 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem model. + */ +@Fluent +public final class SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem + implements JsonSerializable { + /* + * IPV4 address + */ + private String ipAddress; + + /* + * IPV4 netmask + */ + private String mask; + + /** + * Creates an instance of SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem class. + */ + public SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem() { + } + + /** + * Get the ipAddress property: IPV4 address. + * + * @return the ipAddress value. + */ + public String ipAddress() { + return this.ipAddress; + } + + /** + * Set the ipAddress property: IPV4 address. + * + * @param ipAddress the ipAddress value to set. + * @return the SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem object itself. + */ + public SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem withIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + /** + * Get the mask property: IPV4 netmask. + * + * @return the mask value. + */ + public String mask() { + return this.mask; + } + + /** + * Set the mask property: IPV4 netmask. + * + * @param mask the mask value to set. + * @return the SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem object itself. + */ + public SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem withMask(String mask) { + this.mask = mask; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("ipAddress", this.ipAddress); + jsonWriter.writeStringField("mask", this.mask); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem if the JsonReader was pointing to + * an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem. + */ + public static SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem deserializedSqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem + = new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ipAddress".equals(fieldName)) { + deserializedSqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem.ipAddress = reader.getString(); + } else if ("mask".equals(fieldName)) { + deserializedSqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem.mask = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaResourceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaResourceProperties.java new file mode 100644 index 000000000000..337ba42a29e3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaResourceProperties.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.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of Arc Sql availability group replica resource. + */ +@Fluent +public final class SqlAvailabilityGroupReplicaResourceProperties + implements JsonSerializable { + /* + * ID GUID of the availability group. + */ + private String replicaId; + + /* + * the replica name. + */ + private String replicaName; + + /* + * null + */ + private AvailabilityGroupConfigure configure; + + /* + * null + */ + private AvailabilityGroupState state; + + /** + * Creates an instance of SqlAvailabilityGroupReplicaResourceProperties class. + */ + public SqlAvailabilityGroupReplicaResourceProperties() { + } + + /** + * Get the replicaId property: ID GUID of the availability group. + * + * @return the replicaId value. + */ + public String replicaId() { + return this.replicaId; + } + + /** + * Get the replicaName property: the replica name. + * + * @return the replicaName value. + */ + public String replicaName() { + return this.replicaName; + } + + /** + * Set the replicaName property: the replica name. + * + * @param replicaName the replicaName value to set. + * @return the SqlAvailabilityGroupReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupReplicaResourceProperties withReplicaName(String replicaName) { + this.replicaName = replicaName; + return this; + } + + /** + * Get the configure property: null. + * + * @return the configure value. + */ + public AvailabilityGroupConfigure configure() { + return this.configure; + } + + /** + * Set the configure property: null. + * + * @param configure the configure value to set. + * @return the SqlAvailabilityGroupReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupReplicaResourceProperties withConfigure(AvailabilityGroupConfigure configure) { + this.configure = configure; + return this; + } + + /** + * Get the state property: null. + * + * @return the state value. + */ + public AvailabilityGroupState state() { + return this.state; + } + + /** + * Set the state property: null. + * + * @param state the state value to set. + * @return the SqlAvailabilityGroupReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupReplicaResourceProperties withState(AvailabilityGroupState state) { + this.state = state; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (configure() != null) { + configure().validate(); + } + if (state() != null) { + state().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("replicaName", this.replicaName); + jsonWriter.writeJsonField("configure", this.configure); + jsonWriter.writeJsonField("state", this.state); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlAvailabilityGroupReplicaResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlAvailabilityGroupReplicaResourceProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlAvailabilityGroupReplicaResourceProperties. + */ + public static SqlAvailabilityGroupReplicaResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlAvailabilityGroupReplicaResourceProperties deserializedSqlAvailabilityGroupReplicaResourceProperties + = new SqlAvailabilityGroupReplicaResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("replicaId".equals(fieldName)) { + deserializedSqlAvailabilityGroupReplicaResourceProperties.replicaId = reader.getString(); + } else if ("replicaName".equals(fieldName)) { + deserializedSqlAvailabilityGroupReplicaResourceProperties.replicaName = reader.getString(); + } else if ("configure".equals(fieldName)) { + deserializedSqlAvailabilityGroupReplicaResourceProperties.configure + = AvailabilityGroupConfigure.fromJson(reader); + } else if ("state".equals(fieldName)) { + deserializedSqlAvailabilityGroupReplicaResourceProperties.state + = AvailabilityGroupState.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlAvailabilityGroupReplicaResourceProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupStaticIpListenerProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupStaticIpListenerProperties.java new file mode 100644 index 000000000000..f2a356cbe37a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupStaticIpListenerProperties.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.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The properties of a static IP Arc Sql availability group listener. + */ +@Fluent +public final class SqlAvailabilityGroupStaticIpListenerProperties + implements JsonSerializable { + /* + * the DNS name for the listener. + */ + private String dnsName; + + /* + * IP V4 Addresses and masks for the listener. + */ + private List ipV4AddressesAndMasks; + + /* + * IP V6 Addresses for the listener + */ + private List ipV6Addresses; + + /* + * Network port for the listener. Default is 1433. + */ + private Integer port; + + /** + * Creates an instance of SqlAvailabilityGroupStaticIpListenerProperties class. + */ + public SqlAvailabilityGroupStaticIpListenerProperties() { + } + + /** + * Get the dnsName property: the DNS name for the listener. + * + * @return the dnsName value. + */ + public String dnsName() { + return this.dnsName; + } + + /** + * Set the dnsName property: the DNS name for the listener. + * + * @param dnsName the dnsName value to set. + * @return the SqlAvailabilityGroupStaticIpListenerProperties object itself. + */ + public SqlAvailabilityGroupStaticIpListenerProperties withDnsName(String dnsName) { + this.dnsName = dnsName; + return this; + } + + /** + * Get the ipV4AddressesAndMasks property: IP V4 Addresses and masks for the listener. + * + * @return the ipV4AddressesAndMasks value. + */ + public List ipV4AddressesAndMasks() { + return this.ipV4AddressesAndMasks; + } + + /** + * Set the ipV4AddressesAndMasks property: IP V4 Addresses and masks for the listener. + * + * @param ipV4AddressesAndMasks the ipV4AddressesAndMasks value to set. + * @return the SqlAvailabilityGroupStaticIpListenerProperties object itself. + */ + public SqlAvailabilityGroupStaticIpListenerProperties + withIpV4AddressesAndMasks(List ipV4AddressesAndMasks) { + this.ipV4AddressesAndMasks = ipV4AddressesAndMasks; + return this; + } + + /** + * Get the ipV6Addresses property: IP V6 Addresses for the listener. + * + * @return the ipV6Addresses value. + */ + public List ipV6Addresses() { + return this.ipV6Addresses; + } + + /** + * Set the ipV6Addresses property: IP V6 Addresses for the listener. + * + * @param ipV6Addresses the ipV6Addresses value to set. + * @return the SqlAvailabilityGroupStaticIpListenerProperties object itself. + */ + public SqlAvailabilityGroupStaticIpListenerProperties withIpV6Addresses(List ipV6Addresses) { + this.ipV6Addresses = ipV6Addresses; + return this; + } + + /** + * Get the port property: Network port for the listener. Default is 1433. + * + * @return the port value. + */ + public Integer port() { + return this.port; + } + + /** + * Set the port property: Network port for the listener. Default is 1433. + * + * @param port the port value to set. + * @return the SqlAvailabilityGroupStaticIpListenerProperties object itself. + */ + public SqlAvailabilityGroupStaticIpListenerProperties withPort(Integer port) { + this.port = port; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ipV4AddressesAndMasks() != null) { + ipV4AddressesAndMasks().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dnsName", this.dnsName); + jsonWriter.writeArrayField("ipV4AddressesAndMasks", this.ipV4AddressesAndMasks, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("ipV6Addresses", this.ipV6Addresses, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeNumberField("port", this.port); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlAvailabilityGroupStaticIpListenerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlAvailabilityGroupStaticIpListenerProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlAvailabilityGroupStaticIpListenerProperties. + */ + public static SqlAvailabilityGroupStaticIpListenerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlAvailabilityGroupStaticIpListenerProperties deserializedSqlAvailabilityGroupStaticIpListenerProperties + = new SqlAvailabilityGroupStaticIpListenerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dnsName".equals(fieldName)) { + deserializedSqlAvailabilityGroupStaticIpListenerProperties.dnsName = reader.getString(); + } else if ("ipV4AddressesAndMasks".equals(fieldName)) { + List ipV4AddressesAndMasks + = reader.readArray( + reader1 -> SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem.fromJson(reader1)); + deserializedSqlAvailabilityGroupStaticIpListenerProperties.ipV4AddressesAndMasks + = ipV4AddressesAndMasks; + } else if ("ipV6Addresses".equals(fieldName)) { + List ipV6Addresses = reader.readArray(reader1 -> reader1.getString()); + deserializedSqlAvailabilityGroupStaticIpListenerProperties.ipV6Addresses = ipV6Addresses; + } else if ("port".equals(fieldName)) { + deserializedSqlAvailabilityGroupStaticIpListenerProperties.port + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlAvailabilityGroupStaticIpListenerProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstance.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstance.java index e2d2a9b66574..76665e7d7da5 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstance.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstance.java @@ -10,117 +10,125 @@ import com.azure.resourcemanager.azurearcdata.fluent.models.SqlManagedInstanceInner; import java.util.Map; -/** An immutable client-side representation of SqlManagedInstance. */ +/** + * An immutable client-side representation of SqlManagedInstance. + */ public interface SqlManagedInstance { /** * 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 properties property: null. - * + * * @return the properties value. */ SqlManagedInstanceProperties properties(); /** * Gets the extendedLocation property: The extendedLocation of the resource. - * + * * @return the extendedLocation value. */ ExtendedLocation extendedLocation(); /** * Gets the sku property: Resource sku. - * + * * @return the sku value. */ SqlManagedInstanceSku sku(); /** - * Gets the systemData property: Read only system data. - * + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * * @return the systemData value. */ SystemData systemData(); /** * 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.azurearcdata.fluent.models.SqlManagedInstanceInner object. - * + * * @return the inner object. */ SqlManagedInstanceInner innerModel(); - /** The entirety of the SqlManagedInstance definition. */ - interface Definition - extends DefinitionStages.Blank, - DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, - DefinitionStages.WithProperties, - DefinitionStages.WithCreate { + /** + * The entirety of the SqlManagedInstance definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithProperties, DefinitionStages.WithCreate { } - /** The SqlManagedInstance definition stages. */ + + /** + * The SqlManagedInstance definition stages. + */ interface DefinitionStages { - /** The first stage of the SqlManagedInstance definition. */ + /** + * The first stage of the SqlManagedInstance definition. + */ interface Blank extends WithLocation { } - /** The stage of the SqlManagedInstance definition allowing to specify location. */ + + /** + * The stage of the SqlManagedInstance 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. */ @@ -128,32 +136,39 @@ interface WithLocation { /** * 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 SqlManagedInstance definition allowing to specify parent resource. */ + + /** + * The stage of the SqlManagedInstance definition allowing to specify parent resource. + */ interface WithResourceGroup { /** * Specifies resourceGroupName. - * + * * @param resourceGroupName The name of the Azure resource group. * @return the next definition stage. */ WithProperties withExistingResourceGroup(String resourceGroupName); } - /** The stage of the SqlManagedInstance definition allowing to specify properties. */ + + /** + * The stage of the SqlManagedInstance definition allowing to specify properties. + */ interface WithProperties { /** * Specifies the properties property: null. - * + * * @param properties null. * @return the next definition stage. */ WithCreate withProperties(SqlManagedInstanceProperties properties); } + /** * The stage of the SqlManagedInstance 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. @@ -162,97 +177,115 @@ interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithExtendedLocation, DefinitionStages.WithSku { /** * Executes the create request. - * + * * @return the created resource. */ SqlManagedInstance create(); /** * Executes the create request. - * + * * @param context The context to associate with this operation. * @return the created resource. */ SqlManagedInstance create(Context context); } - /** The stage of the SqlManagedInstance definition allowing to specify tags. */ + + /** + * The stage of the SqlManagedInstance 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 SqlManagedInstance definition allowing to specify extendedLocation. */ + + /** + * The stage of the SqlManagedInstance definition allowing to specify extendedLocation. + */ interface WithExtendedLocation { /** * Specifies the extendedLocation property: The extendedLocation of the resource.. - * + * * @param extendedLocation The extendedLocation of the resource. * @return the next definition stage. */ WithCreate withExtendedLocation(ExtendedLocation extendedLocation); } - /** The stage of the SqlManagedInstance definition allowing to specify sku. */ + + /** + * The stage of the SqlManagedInstance definition allowing to specify sku. + */ interface WithSku { /** * Specifies the sku property: Resource sku.. - * + * * @param sku Resource sku. * @return the next definition stage. */ WithCreate withSku(SqlManagedInstanceSku sku); } } + /** * Begins update for the SqlManagedInstance resource. - * + * * @return the stage of resource update. */ SqlManagedInstance.Update update(); - /** The template for SqlManagedInstance update. */ + /** + * The template for SqlManagedInstance update. + */ interface Update extends UpdateStages.WithTags { /** * Executes the update request. - * + * * @return the updated resource. */ SqlManagedInstance apply(); /** * Executes the update request. - * + * * @param context The context to associate with this operation. * @return the updated resource. */ SqlManagedInstance apply(Context context); } - /** The SqlManagedInstance update stages. */ + + /** + * The SqlManagedInstance update stages. + */ interface UpdateStages { - /** The stage of the SqlManagedInstance update allowing to specify tags. */ + /** + * The stage of the SqlManagedInstance update allowing to specify tags. + */ interface WithTags { /** * Specifies the tags property: Resource tags.. - * + * * @param tags Resource tags. * @return the next definition stage. */ Update withTags(Map tags); } } + /** * Refreshes the resource to sync with Azure. - * + * * @return the refreshed resource. */ SqlManagedInstance refresh(); /** * Refreshes the resource to sync with Azure. - * + * * @param context The context to associate with this operation. * @return the refreshed resource. */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SRaw.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SRaw.java index 2d42dae51019..652040adba86 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SRaw.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SRaw.java @@ -5,34 +5,38 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.HashMap; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; import java.util.Map; -/** The raw kubernetes information. */ +/** + * The raw kubernetes information. + */ @Fluent -public final class SqlManagedInstanceK8SRaw { +public final class SqlManagedInstanceK8SRaw implements JsonSerializable { /* * The kubernetes spec information. */ - @JsonProperty(value = "spec") private SqlManagedInstanceK8SSpec spec; /* * The raw kubernetes information. */ - @JsonIgnore private Map additionalProperties; + private Map additionalProperties; - /** Creates an instance of SqlManagedInstanceK8SRaw class. */ + /** + * Creates an instance of SqlManagedInstanceK8SRaw class. + */ public SqlManagedInstanceK8SRaw() { } /** * Get the spec property: The kubernetes spec information. - * + * * @return the spec value. */ public SqlManagedInstanceK8SSpec spec() { @@ -41,7 +45,7 @@ public SqlManagedInstanceK8SSpec spec() { /** * Set the spec property: The kubernetes spec information. - * + * * @param spec the spec value to set. * @return the SqlManagedInstanceK8SRaw object itself. */ @@ -52,17 +56,16 @@ public SqlManagedInstanceK8SRaw withSpec(SqlManagedInstanceK8SSpec spec) { /** * Get the additionalProperties property: The raw kubernetes information. - * + * * @return the additionalProperties value. */ - @JsonAnyGetter public Map additionalProperties() { return this.additionalProperties; } /** * Set the additionalProperties property: The raw kubernetes information. - * + * * @param additionalProperties the additionalProperties value to set. * @return the SqlManagedInstanceK8SRaw object itself. */ @@ -71,17 +74,9 @@ public SqlManagedInstanceK8SRaw withAdditionalProperties(Map add return this; } - @JsonAnySetter - void withAdditionalProperties(String key, Object value) { - if (additionalProperties == null) { - additionalProperties = new HashMap<>(); - } - additionalProperties.put(key, value); - } - /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -89,4 +84,51 @@ public void validate() { spec().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("spec", this.spec); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlManagedInstanceK8SRaw from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlManagedInstanceK8SRaw if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlManagedInstanceK8SRaw. + */ + public static SqlManagedInstanceK8SRaw fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlManagedInstanceK8SRaw deserializedSqlManagedInstanceK8SRaw = new SqlManagedInstanceK8SRaw(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("spec".equals(fieldName)) { + deserializedSqlManagedInstanceK8SRaw.spec = SqlManagedInstanceK8SSpec.fromJson(reader); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedSqlManagedInstanceK8SRaw.additionalProperties = additionalProperties; + + return deserializedSqlManagedInstanceK8SRaw; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SSpec.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SSpec.java index 0e1488f60a7d..b2bece3fd474 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SSpec.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SSpec.java @@ -5,20 +5,22 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.HashMap; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; import java.util.Map; -/** The kubernetes spec information. */ +/** + * The kubernetes spec information. + */ @Fluent -public final class SqlManagedInstanceK8SSpec { +public final class SqlManagedInstanceK8SSpec implements JsonSerializable { /* * The kubernetes scheduling information. */ - @JsonProperty(value = "scheduling") private K8SScheduling scheduling; /* @@ -26,21 +28,32 @@ public final class SqlManagedInstanceK8SSpec { * cluster for high availability purposes. If sku.tier is BusinessCritical, allowed values are '2' or '3' with * default of '3'. If sku.tier is GeneralPurpose, replicas must be '1'. */ - @JsonProperty(value = "replicas") private Integer replicas; + /* + * The kubernetes security information. + */ + private K8SSecurity security; + + /* + * The kubernetes settings information. + */ + private K8SSettings settings; + /* * The kubernetes spec information. */ - @JsonIgnore private Map additionalProperties; + private Map additionalProperties; - /** Creates an instance of SqlManagedInstanceK8SSpec class. */ + /** + * Creates an instance of SqlManagedInstanceK8SSpec class. + */ public SqlManagedInstanceK8SSpec() { } /** * Get the scheduling property: The kubernetes scheduling information. - * + * * @return the scheduling value. */ public K8SScheduling scheduling() { @@ -49,7 +62,7 @@ public K8SScheduling scheduling() { /** * Set the scheduling property: The kubernetes scheduling information. - * + * * @param scheduling the scheduling value to set. * @return the SqlManagedInstanceK8SSpec object itself. */ @@ -62,7 +75,7 @@ public SqlManagedInstanceK8SSpec withScheduling(K8SScheduling scheduling) { * Get the replicas property: This option specifies the number of SQL Managed Instance replicas that will be * deployed in your Kubernetes cluster for high availability purposes. If sku.tier is BusinessCritical, allowed * values are '2' or '3' with default of '3'. If sku.tier is GeneralPurpose, replicas must be '1'. - * + * * @return the replicas value. */ public Integer replicas() { @@ -73,7 +86,7 @@ public Integer replicas() { * Set the replicas property: This option specifies the number of SQL Managed Instance replicas that will be * deployed in your Kubernetes cluster for high availability purposes. If sku.tier is BusinessCritical, allowed * values are '2' or '3' with default of '3'. If sku.tier is GeneralPurpose, replicas must be '1'. - * + * * @param replicas the replicas value to set. * @return the SqlManagedInstanceK8SSpec object itself. */ @@ -82,19 +95,58 @@ public SqlManagedInstanceK8SSpec withReplicas(Integer replicas) { return this; } + /** + * Get the security property: The kubernetes security information. + * + * @return the security value. + */ + public K8SSecurity security() { + return this.security; + } + + /** + * Set the security property: The kubernetes security information. + * + * @param security the security value to set. + * @return the SqlManagedInstanceK8SSpec object itself. + */ + public SqlManagedInstanceK8SSpec withSecurity(K8SSecurity security) { + this.security = security; + return this; + } + + /** + * Get the settings property: The kubernetes settings information. + * + * @return the settings value. + */ + public K8SSettings settings() { + return this.settings; + } + + /** + * Set the settings property: The kubernetes settings information. + * + * @param settings the settings value to set. + * @return the SqlManagedInstanceK8SSpec object itself. + */ + public SqlManagedInstanceK8SSpec withSettings(K8SSettings settings) { + this.settings = settings; + return this; + } + /** * Get the additionalProperties property: The kubernetes spec information. - * + * * @return the additionalProperties value. */ - @JsonAnyGetter public Map additionalProperties() { return this.additionalProperties; } /** * Set the additionalProperties property: The kubernetes spec information. - * + * * @param additionalProperties the additionalProperties value to set. * @return the SqlManagedInstanceK8SSpec object itself. */ @@ -103,22 +155,76 @@ public SqlManagedInstanceK8SSpec withAdditionalProperties(Map ad return this; } - @JsonAnySetter - void withAdditionalProperties(String key, Object value) { - if (additionalProperties == null) { - additionalProperties = new HashMap<>(); - } - additionalProperties.put(key, value); - } - /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (scheduling() != null) { scheduling().validate(); } + if (security() != null) { + security().validate(); + } + if (settings() != null) { + settings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("scheduling", this.scheduling); + jsonWriter.writeNumberField("replicas", this.replicas); + jsonWriter.writeJsonField("security", this.security); + jsonWriter.writeJsonField("settings", this.settings); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlManagedInstanceK8SSpec from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlManagedInstanceK8SSpec if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlManagedInstanceK8SSpec. + */ + public static SqlManagedInstanceK8SSpec fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlManagedInstanceK8SSpec deserializedSqlManagedInstanceK8SSpec = new SqlManagedInstanceK8SSpec(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("scheduling".equals(fieldName)) { + deserializedSqlManagedInstanceK8SSpec.scheduling = K8SScheduling.fromJson(reader); + } else if ("replicas".equals(fieldName)) { + deserializedSqlManagedInstanceK8SSpec.replicas = reader.getNullable(JsonReader::getInt); + } else if ("security".equals(fieldName)) { + deserializedSqlManagedInstanceK8SSpec.security = K8SSecurity.fromJson(reader); + } else if ("settings".equals(fieldName)) { + deserializedSqlManagedInstanceK8SSpec.settings = K8SSettings.fromJson(reader); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedSqlManagedInstanceK8SSpec.additionalProperties = additionalProperties; + + return deserializedSqlManagedInstanceK8SSpec; + }); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceListResult.java index 9d19c43f2d10..5def4b68e6c8 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceListResult.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceListResult.java @@ -5,32 +5,38 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.azurearcdata.fluent.models.SqlManagedInstanceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** A list of SqlManagedInstance. */ +/** + * A list of SqlManagedInstance. + */ @Immutable -public final class SqlManagedInstanceListResult { +public final class SqlManagedInstanceListResult implements JsonSerializable { /* * Array of results. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * Link to retrieve next page of results. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; - /** Creates an instance of SqlManagedInstanceListResult class. */ + /** + * Creates an instance of SqlManagedInstanceListResult class. + */ public SqlManagedInstanceListResult() { } /** * Get the value property: Array of results. - * + * * @return the value value. */ public List value() { @@ -39,7 +45,7 @@ public List value() { /** * Get the nextLink property: Link to retrieve next page of results. - * + * * @return the nextLink value. */ public String nextLink() { @@ -48,7 +54,7 @@ public String nextLink() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -56,4 +62,43 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlManagedInstanceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlManagedInstanceListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlManagedInstanceListResult. + */ + public static SqlManagedInstanceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlManagedInstanceListResult deserializedSqlManagedInstanceListResult = new SqlManagedInstanceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlManagedInstanceInner.fromJson(reader1)); + deserializedSqlManagedInstanceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSqlManagedInstanceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlManagedInstanceListResult; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceProperties.java index a614296d6145..d157d8d1917a 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceProperties.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceProperties.java @@ -5,86 +5,90 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; -/** Properties of sqlManagedInstance. */ +/** + * Properties of sqlManagedInstance. + */ @Fluent -public final class SqlManagedInstanceProperties { +public final class SqlManagedInstanceProperties implements JsonSerializable { /* * null */ - @JsonProperty(value = "dataControllerId") private String dataControllerId; /* * The instance admin user */ - @JsonProperty(value = "admin") private String admin; /* * The instance start time */ - @JsonProperty(value = "startTime") private String startTime; /* * The instance end time */ - @JsonProperty(value = "endTime") private String endTime; /* * The raw kubernetes information */ - @JsonProperty(value = "k8sRaw") private SqlManagedInstanceK8SRaw k8SRaw; /* * Username and password for basic authentication. */ - @JsonProperty(value = "basicLoginInformation") private BasicLoginInformation basicLoginInformation; /* * Last uploaded date from Kubernetes cluster. Defaults to current date time */ - @JsonProperty(value = "lastUploadedDate") private OffsetDateTime lastUploadedDate; /* - * The provisioningState property. + * The provisioning state of the Arc-enabled SQL Managed Instance resource. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private String provisioningState; + /* + * Active Directory information related to this SQL Managed Instance. + */ + private ActiveDirectoryInformation activeDirectoryInformation; + /* * The license type to apply for this managed instance. */ - @JsonProperty(value = "licenseType") private ArcSqlManagedInstanceLicenseType licenseType; /* * If a CustomLocation is provided, this contains the ARM id of the connected cluster the custom location belongs * to. */ - @JsonProperty(value = "clusterId") private String clusterId; /* * If a CustomLocation is provided, this contains the ARM id of the extension the custom location belongs to. */ - @JsonProperty(value = "extensionId") private String extensionId; - /** Creates an instance of SqlManagedInstanceProperties class. */ + /** + * Creates an instance of SqlManagedInstanceProperties class. + */ public SqlManagedInstanceProperties() { } /** * Get the dataControllerId property: null. - * + * * @return the dataControllerId value. */ public String dataControllerId() { @@ -93,7 +97,7 @@ public String dataControllerId() { /** * Set the dataControllerId property: null. - * + * * @param dataControllerId the dataControllerId value to set. * @return the SqlManagedInstanceProperties object itself. */ @@ -104,7 +108,7 @@ public SqlManagedInstanceProperties withDataControllerId(String dataControllerId /** * Get the admin property: The instance admin user. - * + * * @return the admin value. */ public String admin() { @@ -113,7 +117,7 @@ public String admin() { /** * Set the admin property: The instance admin user. - * + * * @param admin the admin value to set. * @return the SqlManagedInstanceProperties object itself. */ @@ -124,7 +128,7 @@ public SqlManagedInstanceProperties withAdmin(String admin) { /** * Get the startTime property: The instance start time. - * + * * @return the startTime value. */ public String startTime() { @@ -133,7 +137,7 @@ public String startTime() { /** * Set the startTime property: The instance start time. - * + * * @param startTime the startTime value to set. * @return the SqlManagedInstanceProperties object itself. */ @@ -144,7 +148,7 @@ public SqlManagedInstanceProperties withStartTime(String startTime) { /** * Get the endTime property: The instance end time. - * + * * @return the endTime value. */ public String endTime() { @@ -153,7 +157,7 @@ public String endTime() { /** * Set the endTime property: The instance end time. - * + * * @param endTime the endTime value to set. * @return the SqlManagedInstanceProperties object itself. */ @@ -164,7 +168,7 @@ public SqlManagedInstanceProperties withEndTime(String endTime) { /** * Get the k8SRaw property: The raw kubernetes information. - * + * * @return the k8SRaw value. */ public SqlManagedInstanceK8SRaw k8SRaw() { @@ -173,7 +177,7 @@ public SqlManagedInstanceK8SRaw k8SRaw() { /** * Set the k8SRaw property: The raw kubernetes information. - * + * * @param k8SRaw the k8SRaw value to set. * @return the SqlManagedInstanceProperties object itself. */ @@ -184,7 +188,7 @@ public SqlManagedInstanceProperties withK8SRaw(SqlManagedInstanceK8SRaw k8SRaw) /** * Get the basicLoginInformation property: Username and password for basic authentication. - * + * * @return the basicLoginInformation value. */ public BasicLoginInformation basicLoginInformation() { @@ -193,7 +197,7 @@ public BasicLoginInformation basicLoginInformation() { /** * Set the basicLoginInformation property: Username and password for basic authentication. - * + * * @param basicLoginInformation the basicLoginInformation value to set. * @return the SqlManagedInstanceProperties object itself. */ @@ -204,7 +208,7 @@ public SqlManagedInstanceProperties withBasicLoginInformation(BasicLoginInformat /** * Get the lastUploadedDate property: Last uploaded date from Kubernetes cluster. Defaults to current date time. - * + * * @return the lastUploadedDate value. */ public OffsetDateTime lastUploadedDate() { @@ -213,7 +217,7 @@ public OffsetDateTime lastUploadedDate() { /** * Set the lastUploadedDate property: Last uploaded date from Kubernetes cluster. Defaults to current date time. - * + * * @param lastUploadedDate the lastUploadedDate value to set. * @return the SqlManagedInstanceProperties object itself. */ @@ -223,17 +227,38 @@ public SqlManagedInstanceProperties withLastUploadedDate(OffsetDateTime lastUplo } /** - * Get the provisioningState property: The provisioningState property. - * + * Get the provisioningState property: The provisioning state of the Arc-enabled SQL Managed Instance resource. + * * @return the provisioningState value. */ public String provisioningState() { return this.provisioningState; } + /** + * Get the activeDirectoryInformation property: Active Directory information related to this SQL Managed Instance. + * + * @return the activeDirectoryInformation value. + */ + public ActiveDirectoryInformation activeDirectoryInformation() { + return this.activeDirectoryInformation; + } + + /** + * Set the activeDirectoryInformation property: Active Directory information related to this SQL Managed Instance. + * + * @param activeDirectoryInformation the activeDirectoryInformation value to set. + * @return the SqlManagedInstanceProperties object itself. + */ + public SqlManagedInstanceProperties + withActiveDirectoryInformation(ActiveDirectoryInformation activeDirectoryInformation) { + this.activeDirectoryInformation = activeDirectoryInformation; + return this; + } + /** * Get the licenseType property: The license type to apply for this managed instance. - * + * * @return the licenseType value. */ public ArcSqlManagedInstanceLicenseType licenseType() { @@ -242,7 +267,7 @@ public ArcSqlManagedInstanceLicenseType licenseType() { /** * Set the licenseType property: The license type to apply for this managed instance. - * + * * @param licenseType the licenseType value to set. * @return the SqlManagedInstanceProperties object itself. */ @@ -254,7 +279,7 @@ public SqlManagedInstanceProperties withLicenseType(ArcSqlManagedInstanceLicense /** * Get the clusterId property: If a CustomLocation is provided, this contains the ARM id of the connected cluster * the custom location belongs to. - * + * * @return the clusterId value. */ public String clusterId() { @@ -264,7 +289,7 @@ public String clusterId() { /** * Set the clusterId property: If a CustomLocation is provided, this contains the ARM id of the connected cluster * the custom location belongs to. - * + * * @param clusterId the clusterId value to set. * @return the SqlManagedInstanceProperties object itself. */ @@ -276,7 +301,7 @@ public SqlManagedInstanceProperties withClusterId(String clusterId) { /** * Get the extensionId property: If a CustomLocation is provided, this contains the ARM id of the extension the * custom location belongs to. - * + * * @return the extensionId value. */ public String extensionId() { @@ -286,7 +311,7 @@ public String extensionId() { /** * Set the extensionId property: If a CustomLocation is provided, this contains the ARM id of the extension the * custom location belongs to. - * + * * @param extensionId the extensionId value to set. * @return the SqlManagedInstanceProperties object itself. */ @@ -297,7 +322,7 @@ public SqlManagedInstanceProperties withExtensionId(String extensionId) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -307,5 +332,83 @@ public void validate() { if (basicLoginInformation() != null) { basicLoginInformation().validate(); } + if (activeDirectoryInformation() != null) { + activeDirectoryInformation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dataControllerId", this.dataControllerId); + jsonWriter.writeStringField("admin", this.admin); + jsonWriter.writeStringField("startTime", this.startTime); + jsonWriter.writeStringField("endTime", this.endTime); + jsonWriter.writeJsonField("k8sRaw", this.k8SRaw); + jsonWriter.writeJsonField("basicLoginInformation", this.basicLoginInformation); + jsonWriter.writeStringField("lastUploadedDate", + this.lastUploadedDate == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUploadedDate)); + jsonWriter.writeJsonField("activeDirectoryInformation", this.activeDirectoryInformation); + jsonWriter.writeStringField("licenseType", this.licenseType == null ? null : this.licenseType.toString()); + jsonWriter.writeStringField("clusterId", this.clusterId); + jsonWriter.writeStringField("extensionId", this.extensionId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlManagedInstanceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlManagedInstanceProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlManagedInstanceProperties. + */ + public static SqlManagedInstanceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlManagedInstanceProperties deserializedSqlManagedInstanceProperties = new SqlManagedInstanceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataControllerId".equals(fieldName)) { + deserializedSqlManagedInstanceProperties.dataControllerId = reader.getString(); + } else if ("admin".equals(fieldName)) { + deserializedSqlManagedInstanceProperties.admin = reader.getString(); + } else if ("startTime".equals(fieldName)) { + deserializedSqlManagedInstanceProperties.startTime = reader.getString(); + } else if ("endTime".equals(fieldName)) { + deserializedSqlManagedInstanceProperties.endTime = reader.getString(); + } else if ("k8sRaw".equals(fieldName)) { + deserializedSqlManagedInstanceProperties.k8SRaw = SqlManagedInstanceK8SRaw.fromJson(reader); + } else if ("basicLoginInformation".equals(fieldName)) { + deserializedSqlManagedInstanceProperties.basicLoginInformation + = BasicLoginInformation.fromJson(reader); + } else if ("lastUploadedDate".equals(fieldName)) { + deserializedSqlManagedInstanceProperties.lastUploadedDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedSqlManagedInstanceProperties.provisioningState = reader.getString(); + } else if ("activeDirectoryInformation".equals(fieldName)) { + deserializedSqlManagedInstanceProperties.activeDirectoryInformation + = ActiveDirectoryInformation.fromJson(reader); + } else if ("licenseType".equals(fieldName)) { + deserializedSqlManagedInstanceProperties.licenseType + = ArcSqlManagedInstanceLicenseType.fromString(reader.getString()); + } else if ("clusterId".equals(fieldName)) { + deserializedSqlManagedInstanceProperties.clusterId = reader.getString(); + } else if ("extensionId".equals(fieldName)) { + deserializedSqlManagedInstanceProperties.extensionId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlManagedInstanceProperties; + }); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceSku.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceSku.java index 1d5c5fc2b7b3..81a328575d81 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceSku.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceSku.java @@ -5,56 +5,57 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The resource model definition representing SKU for Azure Managed Instance - Azure Arc. */ +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The resource model definition representing SKU for Azure Managed Instance - Azure Arc. + */ @Fluent -public final class SqlManagedInstanceSku { +public final class SqlManagedInstanceSku implements JsonSerializable { /* * The name of the SKU. */ - @JsonProperty(value = "name", required = true) private String name = "vCore"; /* * The pricing tier for the instance. */ - @JsonProperty(value = "tier") private SqlManagedInstanceSkuTier tier; /* * Whether dev/test is enabled. When the dev field is set to true, the resource is used for dev/test purpose. */ - @JsonProperty(value = "dev") private Boolean dev; /* * The SKU size. When the name field is the combination of tier and some other value, this would be the standalone * code. */ - @JsonProperty(value = "size") private String size; /* - * The family property. + * The SKU family */ - @JsonProperty(value = "family") private String family; /* - * The capacity property. + * The SKU capacity */ - @JsonProperty(value = "capacity") private Integer capacity; - /** Creates an instance of SqlManagedInstanceSku class. */ + /** + * Creates an instance of SqlManagedInstanceSku class. + */ public SqlManagedInstanceSku() { - name = "vCore"; } /** * Get the name property: The name of the SKU. - * + * * @return the name value. */ public String name() { @@ -63,7 +64,7 @@ public String name() { /** * Set the name property: The name of the SKU. - * + * * @param name the name value to set. * @return the SqlManagedInstanceSku object itself. */ @@ -74,7 +75,7 @@ public SqlManagedInstanceSku withName(String name) { /** * Get the tier property: The pricing tier for the instance. - * + * * @return the tier value. */ public SqlManagedInstanceSkuTier tier() { @@ -83,7 +84,7 @@ public SqlManagedInstanceSkuTier tier() { /** * Set the tier property: The pricing tier for the instance. - * + * * @param tier the tier value to set. * @return the SqlManagedInstanceSku object itself. */ @@ -95,7 +96,7 @@ public SqlManagedInstanceSku withTier(SqlManagedInstanceSkuTier tier) { /** * Get the dev property: Whether dev/test is enabled. When the dev field is set to true, the resource is used for * dev/test purpose. - * + * * @return the dev value. */ public Boolean dev() { @@ -105,7 +106,7 @@ public Boolean dev() { /** * Set the dev property: Whether dev/test is enabled. When the dev field is set to true, the resource is used for * dev/test purpose. - * + * * @param dev the dev value to set. * @return the SqlManagedInstanceSku object itself. */ @@ -117,7 +118,7 @@ public SqlManagedInstanceSku withDev(Boolean dev) { /** * Get the size property: The SKU size. When the name field is the combination of tier and some other value, this * would be the standalone code. - * + * * @return the size value. */ public String size() { @@ -127,7 +128,7 @@ public String size() { /** * Set the size property: The SKU size. When the name field is the combination of tier and some other value, this * would be the standalone code. - * + * * @param size the size value to set. * @return the SqlManagedInstanceSku object itself. */ @@ -137,8 +138,8 @@ public SqlManagedInstanceSku withSize(String size) { } /** - * Get the family property: The family property. - * + * Get the family property: The SKU family. + * * @return the family value. */ public String family() { @@ -146,8 +147,8 @@ public String family() { } /** - * Set the family property: The family property. - * + * Set the family property: The SKU family. + * * @param family the family value to set. * @return the SqlManagedInstanceSku object itself. */ @@ -157,8 +158,8 @@ public SqlManagedInstanceSku withFamily(String family) { } /** - * Get the capacity property: The capacity property. - * + * Get the capacity property: The SKU capacity. + * * @return the capacity value. */ public Integer capacity() { @@ -166,8 +167,8 @@ public Integer capacity() { } /** - * Set the capacity property: The capacity property. - * + * Set the capacity property: The SKU capacity. + * * @param capacity the capacity value to set. * @return the SqlManagedInstanceSku object itself. */ @@ -178,9 +179,59 @@ public SqlManagedInstanceSku withCapacity(Integer capacity) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("tier", this.tier == null ? null : this.tier.toString()); + jsonWriter.writeBooleanField("dev", this.dev); + jsonWriter.writeStringField("size", this.size); + jsonWriter.writeStringField("family", this.family); + jsonWriter.writeNumberField("capacity", this.capacity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlManagedInstanceSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlManagedInstanceSku if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlManagedInstanceSku. + */ + public static SqlManagedInstanceSku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlManagedInstanceSku deserializedSqlManagedInstanceSku = new SqlManagedInstanceSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tier".equals(fieldName)) { + deserializedSqlManagedInstanceSku.tier = SqlManagedInstanceSkuTier.fromString(reader.getString()); + } else if ("dev".equals(fieldName)) { + deserializedSqlManagedInstanceSku.dev = reader.getNullable(JsonReader::getBoolean); + } else if ("size".equals(fieldName)) { + deserializedSqlManagedInstanceSku.size = reader.getString(); + } else if ("family".equals(fieldName)) { + deserializedSqlManagedInstanceSku.family = reader.getString(); + } else if ("capacity".equals(fieldName)) { + deserializedSqlManagedInstanceSku.capacity = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlManagedInstanceSku; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceSkuTier.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceSkuTier.java index 622397928ed4..4669720a6dcb 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceSkuTier.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceSkuTier.java @@ -4,18 +4,23 @@ package com.azure.resourcemanager.azurearcdata.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** The pricing tier for the instance. */ +/** + * The pricing tier for the instance. + */ public enum SqlManagedInstanceSkuTier { - /** Enum value GeneralPurpose. */ + /** + * Enum value GeneralPurpose. + */ GENERAL_PURPOSE("GeneralPurpose"), - /** Enum value BusinessCritical. */ + /** + * Enum value BusinessCritical. + */ BUSINESS_CRITICAL("BusinessCritical"); - /** The actual serialized value for a SqlManagedInstanceSkuTier instance. */ + /** + * The actual serialized value for a SqlManagedInstanceSkuTier instance. + */ private final String value; SqlManagedInstanceSkuTier(String value) { @@ -24,11 +29,10 @@ public enum SqlManagedInstanceSkuTier { /** * Parses a serialized value to a SqlManagedInstanceSkuTier instance. - * + * * @param value the serialized value to parse. * @return the parsed SqlManagedInstanceSkuTier object, or null if unable to parse. */ - @JsonCreator public static SqlManagedInstanceSkuTier fromString(String value) { if (value == null) { return null; @@ -42,8 +46,9 @@ public static SqlManagedInstanceSkuTier fromString(String value) { return null; } - /** {@inheritDoc} */ - @JsonValue + /** + * {@inheritDoc} + */ @Override public String toString() { return this.value; diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceUpdate.java index 57ca515729f9..a6e0931340c5 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceUpdate.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceUpdate.java @@ -5,27 +5,32 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; -/** An update to a SQL Managed Instance. */ +/** + * An update to a SQL Managed Instance. + */ @Fluent -public final class SqlManagedInstanceUpdate { +public final class SqlManagedInstanceUpdate implements JsonSerializable { /* * Resource tags. */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; - /** Creates an instance of SqlManagedInstanceUpdate class. */ + /** + * Creates an instance of SqlManagedInstanceUpdate class. + */ public SqlManagedInstanceUpdate() { } /** * Get the tags property: Resource tags. - * + * * @return the tags value. */ public Map tags() { @@ -34,7 +39,7 @@ public Map tags() { /** * Set the tags property: Resource tags. - * + * * @param tags the tags value to set. * @return the SqlManagedInstanceUpdate object itself. */ @@ -45,9 +50,46 @@ public SqlManagedInstanceUpdate withTags(Map tags) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlManagedInstanceUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlManagedInstanceUpdate if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlManagedInstanceUpdate. + */ + public static SqlManagedInstanceUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlManagedInstanceUpdate deserializedSqlManagedInstanceUpdate = new SqlManagedInstanceUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlManagedInstanceUpdate.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlManagedInstanceUpdate; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstances.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstances.java index e25ea54ad38b..91e36a0116d2 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstances.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstances.java @@ -8,11 +8,13 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of SqlManagedInstances. */ +/** + * Resource collection API of SqlManagedInstances. + */ public interface SqlManagedInstances { /** * List sqlManagedInstance resources in the 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 SqlManagedInstance as paginated response with {@link PagedIterable}. @@ -21,7 +23,7 @@ public interface SqlManagedInstances { /** * List sqlManagedInstance resources in the 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. @@ -32,9 +34,9 @@ public interface SqlManagedInstances { /** * List sqlManagedInstance resources in the resource group - * - *

Gets all sqlManagedInstances in a resource group. - * + * + * Gets all sqlManagedInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -45,9 +47,9 @@ public interface SqlManagedInstances { /** * List sqlManagedInstance resources in the resource group - * - *

Gets all sqlManagedInstances in a resource group. - * + * + * Gets all sqlManagedInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -59,7 +61,7 @@ public interface SqlManagedInstances { /** * Retrieves a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. @@ -68,12 +70,12 @@ public interface SqlManagedInstances { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a SqlManagedInstance along with {@link Response}. */ - Response getByResourceGroupWithResponse( - String resourceGroupName, String sqlManagedInstanceName, Context context); + Response getByResourceGroupWithResponse(String resourceGroupName, String sqlManagedInstanceName, + Context context); /** * Retrieves a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -85,9 +87,9 @@ Response getByResourceGroupWithResponse( /** * Deletes a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -96,9 +98,9 @@ Response getByResourceGroupWithResponse( /** * Deletes a SQL Managed Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -108,7 +110,7 @@ Response getByResourceGroupWithResponse( /** * Retrieves a SQL Managed Instance resource. - * + * * @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. @@ -119,7 +121,7 @@ Response getByResourceGroupWithResponse( /** * Retrieves a SQL Managed Instance resource. - * + * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -131,7 +133,7 @@ Response getByResourceGroupWithResponse( /** * Deletes a SQL Managed Instance resource. - * + * * @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. @@ -141,7 +143,7 @@ Response getByResourceGroupWithResponse( /** * Deletes a SQL Managed Instance resource. - * + * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -152,7 +154,7 @@ Response getByResourceGroupWithResponse( /** * Begins definition for a new SqlManagedInstance resource. - * + * * @param name resource name. * @return the first stage of the new SqlManagedInstance definition. */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResource.java new file mode 100644 index 000000000000..424bc0ed567c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResource.java @@ -0,0 +1,374 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of SqlServerAvailabilityGroupResource. + */ +public interface SqlServerAvailabilityGroupResource { + /** + * 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 properties property: Properties of Arc Sql Server availability group. + * + * @return the properties value. + */ + SqlServerAvailabilityGroupResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner + * object. + * + * @return the inner object. + */ + SqlServerAvailabilityGroupResourceInner innerModel(); + + /** + * The entirety of the SqlServerAvailabilityGroupResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * The SqlServerAvailabilityGroupResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SqlServerAvailabilityGroupResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the SqlServerAvailabilityGroupResource 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. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the SqlServerAvailabilityGroupResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, sqlServerInstanceName. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @return the next definition stage. + */ + WithProperties withExistingSqlServerInstance(String resourceGroupName, String sqlServerInstanceName); + } + + /** + * The stage of the SqlServerAvailabilityGroupResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Properties of Arc Sql Server availability group. + * + * @param properties Properties of Arc Sql Server availability group. + * @return the next definition stage. + */ + WithCreate withProperties(SqlServerAvailabilityGroupResourceProperties properties); + } + + /** + * The stage of the SqlServerAvailabilityGroupResource 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlServerAvailabilityGroupResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlServerAvailabilityGroupResource create(Context context); + } + + /** + * The stage of the SqlServerAvailabilityGroupResource 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); + } + } + + /** + * Begins update for the SqlServerAvailabilityGroupResource resource. + * + * @return the stage of resource update. + */ + SqlServerAvailabilityGroupResource.Update update(); + + /** + * The template for SqlServerAvailabilityGroupResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlServerAvailabilityGroupResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlServerAvailabilityGroupResource apply(Context context); + } + + /** + * The SqlServerAvailabilityGroupResource update stages. + */ + interface UpdateStages { + /** + * The stage of the SqlServerAvailabilityGroupResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the SqlServerAvailabilityGroupResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The Server Availability Group's properties. + * + * @param properties The Server Availability Group's properties. + * @return the next definition stage. + */ + Update withProperties(SqlServerAvailabilityGroupResourceProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlServerAvailabilityGroupResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlServerAvailabilityGroupResource refresh(Context context); + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response detailViewWithResponse(Context context); + + /** + * Retrieves detailed properties of the Availability Group. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource detailView(); + + /** + * Request manual failover of the availability group to this 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 arc Sql Server Availability Group along with {@link Response}. + */ + Response failoverWithResponse(Context context); + + /** + * Request manual failover of the availability group to this server. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource failover(); + + /** + * Request forced failover of the availability group to this 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 arc Sql Server Availability Group along with {@link Response}. + */ + Response forceFailoverAllowDataLossWithResponse(Context context); + + /** + * Request forced failover of the availability group to this server. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource forceFailoverAllowDataLoss(); + + /** + * Request adding database(s) to an existing availability group. + * + * @param databases The database names to add to the SQL Server availability group 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 arc Sql Server Availability Group along with {@link Response}. + */ + Response addDatabasesWithResponse(Databases databases, Context context); + + /** + * Request adding database(s) to an existing availability group. + * + * @param databases The database names to add to the SQL Server availability group 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 arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource addDatabases(Databases databases); + + /** + * Request removing database(s) from an existing availability group. + * + * @param databases The database names to remove from the SQL Server availability group 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 arc Sql Server Availability Group along with {@link Response}. + */ + Response removeDatabasesWithResponse(Databases databases, Context context); + + /** + * Request removing database(s) from an existing availability group. + * + * @param databases The database names to remove from the SQL Server availability group 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 arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource removeDatabases(Databases databases); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourceProperties.java new file mode 100644 index 000000000000..50ee8b2e28cd --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourceProperties.java @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * The properties of Arc Sql Server availability group resource. + */ +@Fluent +public final class SqlServerAvailabilityGroupResourceProperties + implements JsonSerializable { + /* + * ID GUID of the availability group. + */ + private String availabilityGroupId; + + /* + * the SQL server name. + */ + private String serverName; + + /* + * the SQL Server Instance name. + */ + private String instanceName; + + /* + * Timestamp for when the data was collected from the client machine. + */ + private OffsetDateTime collectionTimestamp; + + /* + * Availability Group Info + */ + private AvailabilityGroupInfo info; + + /* + * A list of Availability Group Replicas. + */ + private SqlServerAvailabilityGroupResourcePropertiesReplicas replicas; + + /* + * A list of Availability Group Database Replicas. + */ + private SqlServerAvailabilityGroupResourcePropertiesDatabases databases; + + /* + * The provisioning state of the Arc-enabled SQL Server availability group resource. + */ + private String provisioningState; + + /** + * Creates an instance of SqlServerAvailabilityGroupResourceProperties class. + */ + public SqlServerAvailabilityGroupResourceProperties() { + } + + /** + * Get the availabilityGroupId property: ID GUID of the availability group. + * + * @return the availabilityGroupId value. + */ + public String availabilityGroupId() { + return this.availabilityGroupId; + } + + /** + * Get the serverName property: the SQL server name. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the instanceName property: the SQL Server Instance name. + * + * @return the instanceName value. + */ + public String instanceName() { + return this.instanceName; + } + + /** + * Get the collectionTimestamp property: Timestamp for when the data was collected from the client machine. + * + * @return the collectionTimestamp value. + */ + public OffsetDateTime collectionTimestamp() { + return this.collectionTimestamp; + } + + /** + * Get the info property: Availability Group Info. + * + * @return the info value. + */ + public AvailabilityGroupInfo info() { + return this.info; + } + + /** + * Set the info property: Availability Group Info. + * + * @param info the info value to set. + * @return the SqlServerAvailabilityGroupResourceProperties object itself. + */ + public SqlServerAvailabilityGroupResourceProperties withInfo(AvailabilityGroupInfo info) { + this.info = info; + return this; + } + + /** + * Get the replicas property: A list of Availability Group Replicas. + * + * @return the replicas value. + */ + public SqlServerAvailabilityGroupResourcePropertiesReplicas replicas() { + return this.replicas; + } + + /** + * Set the replicas property: A list of Availability Group Replicas. + * + * @param replicas the replicas value to set. + * @return the SqlServerAvailabilityGroupResourceProperties object itself. + */ + public SqlServerAvailabilityGroupResourceProperties + withReplicas(SqlServerAvailabilityGroupResourcePropertiesReplicas replicas) { + this.replicas = replicas; + return this; + } + + /** + * Get the databases property: A list of Availability Group Database Replicas. + * + * @return the databases value. + */ + public SqlServerAvailabilityGroupResourcePropertiesDatabases databases() { + return this.databases; + } + + /** + * Set the databases property: A list of Availability Group Database Replicas. + * + * @param databases the databases value to set. + * @return the SqlServerAvailabilityGroupResourceProperties object itself. + */ + public SqlServerAvailabilityGroupResourceProperties + withDatabases(SqlServerAvailabilityGroupResourcePropertiesDatabases databases) { + this.databases = databases; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the Arc-enabled SQL Server availability group + * resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (info() != null) { + info().validate(); + } + if (replicas() != null) { + replicas().validate(); + } + if (databases() != null) { + databases().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("info", this.info); + jsonWriter.writeJsonField("replicas", this.replicas); + jsonWriter.writeJsonField("databases", this.databases); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerAvailabilityGroupResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerAvailabilityGroupResourceProperties if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerAvailabilityGroupResourceProperties. + */ + public static SqlServerAvailabilityGroupResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerAvailabilityGroupResourceProperties deserializedSqlServerAvailabilityGroupResourceProperties + = new SqlServerAvailabilityGroupResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("availabilityGroupId".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.availabilityGroupId = reader.getString(); + } else if ("serverName".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.serverName = reader.getString(); + } else if ("instanceName".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.instanceName = reader.getString(); + } else if ("collectionTimestamp".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.collectionTimestamp = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("info".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.info + = AvailabilityGroupInfo.fromJson(reader); + } else if ("replicas".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.replicas + = SqlServerAvailabilityGroupResourcePropertiesReplicas.fromJson(reader); + } else if ("databases".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.databases + = SqlServerAvailabilityGroupResourcePropertiesDatabases.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.provisioningState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerAvailabilityGroupResourceProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourcePropertiesDatabases.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourcePropertiesDatabases.java new file mode 100644 index 000000000000..780f4df0c4f7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourcePropertiesDatabases.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A list of Availability Group Database Replicas. + */ +@Fluent +public final class SqlServerAvailabilityGroupResourcePropertiesDatabases + implements JsonSerializable { + /* + * Array of Availability Group Database Replicas. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of SqlServerAvailabilityGroupResourcePropertiesDatabases class. + */ + public SqlServerAvailabilityGroupResourcePropertiesDatabases() { + } + + /** + * Get the value property: Array of Availability Group Database Replicas. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of Availability Group Database Replicas. + * + * @param value the value value to set. + * @return the SqlServerAvailabilityGroupResourcePropertiesDatabases object itself. + */ + public SqlServerAvailabilityGroupResourcePropertiesDatabases + 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerAvailabilityGroupResourcePropertiesDatabases from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerAvailabilityGroupResourcePropertiesDatabases if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerAvailabilityGroupResourcePropertiesDatabases. + */ + public static SqlServerAvailabilityGroupResourcePropertiesDatabases fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerAvailabilityGroupResourcePropertiesDatabases deserializedSqlServerAvailabilityGroupResourcePropertiesDatabases + = new SqlServerAvailabilityGroupResourcePropertiesDatabases(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader + .readArray(reader1 -> SqlAvailabilityGroupDatabaseReplicaResourceProperties.fromJson(reader1)); + deserializedSqlServerAvailabilityGroupResourcePropertiesDatabases.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourcePropertiesDatabases.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerAvailabilityGroupResourcePropertiesDatabases; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourcePropertiesReplicas.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourcePropertiesReplicas.java new file mode 100644 index 000000000000..22a08e5c2b0a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourcePropertiesReplicas.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A list of Availability Group Replicas. + */ +@Fluent +public final class SqlServerAvailabilityGroupResourcePropertiesReplicas + implements JsonSerializable { + /* + * Array of Availability Group Replicas. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of SqlServerAvailabilityGroupResourcePropertiesReplicas class. + */ + public SqlServerAvailabilityGroupResourcePropertiesReplicas() { + } + + /** + * Get the value property: Array of Availability Group Replicas. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of Availability Group Replicas. + * + * @param value the value value to set. + * @return the SqlServerAvailabilityGroupResourcePropertiesReplicas object itself. + */ + public SqlServerAvailabilityGroupResourcePropertiesReplicas + 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerAvailabilityGroupResourcePropertiesReplicas from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerAvailabilityGroupResourcePropertiesReplicas if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerAvailabilityGroupResourcePropertiesReplicas. + */ + public static SqlServerAvailabilityGroupResourcePropertiesReplicas fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerAvailabilityGroupResourcePropertiesReplicas deserializedSqlServerAvailabilityGroupResourcePropertiesReplicas + = new SqlServerAvailabilityGroupResourcePropertiesReplicas(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlAvailabilityGroupReplicaResourceProperties.fromJson(reader1)); + deserializedSqlServerAvailabilityGroupResourcePropertiesReplicas.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourcePropertiesReplicas.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerAvailabilityGroupResourcePropertiesReplicas; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupUpdate.java new file mode 100644 index 000000000000..7f68fd1c533d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupUpdate.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.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * An update to availability group resource. + */ +@Fluent +public final class SqlServerAvailabilityGroupUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * The Server Availability Group's properties + */ + private SqlServerAvailabilityGroupResourceProperties properties; + + /** + * Creates an instance of SqlServerAvailabilityGroupUpdate class. + */ + public SqlServerAvailabilityGroupUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the SqlServerAvailabilityGroupUpdate object itself. + */ + public SqlServerAvailabilityGroupUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The Server Availability Group's properties. + * + * @return the properties value. + */ + public SqlServerAvailabilityGroupResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The Server Availability Group's properties. + * + * @param properties the properties value to set. + * @return the SqlServerAvailabilityGroupUpdate object itself. + */ + public SqlServerAvailabilityGroupUpdate withProperties(SqlServerAvailabilityGroupResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerAvailabilityGroupUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerAvailabilityGroupUpdate if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerAvailabilityGroupUpdate. + */ + public static SqlServerAvailabilityGroupUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerAvailabilityGroupUpdate deserializedSqlServerAvailabilityGroupUpdate + = new SqlServerAvailabilityGroupUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerAvailabilityGroupUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupUpdate.properties + = SqlServerAvailabilityGroupResourceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerAvailabilityGroupUpdate; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroups.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroups.java new file mode 100644 index 000000000000..63a42d96db83 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroups.java @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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 SqlServerAvailabilityGroups. + */ +public interface SqlServerAvailabilityGroups { + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Context context); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource get(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName); + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response detailViewWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource detailView(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName); + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response failoverWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource failover(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName); + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response forceFailoverAllowDataLossWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource forceFailoverAllowDataLoss(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName); + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource createAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupCreateUpdateConfiguration createAgConfiguration); + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource createAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, Context context); + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource createDistributedAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration); + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group 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 arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource createDistributedAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, + Context context); + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group 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 arc Sql Server Availability Group along with {@link Response}. + */ + Response addDatabasesWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases, Context context); + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group 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 arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource addDatabases(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Databases databases); + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group 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 arc Sql Server Availability Group along with {@link Response}. + */ + Response removeDatabasesWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases, Context context); + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group 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 arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource removeDatabases(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Databases databases); + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String sqlServerInstanceName); + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String sqlServerInstanceName, + Context context); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + SqlServerAvailabilityGroupResource getById(String id); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @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 SqlServerAvailabilityGroupResource resource. + * + * @param name resource name. + * @return the first stage of the new SqlServerAvailabilityGroupResource definition. + */ + SqlServerAvailabilityGroupResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResource.java new file mode 100644 index 000000000000..33a166e78719 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResource.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerDatabaseResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of SqlServerDatabaseResource. + */ +public interface SqlServerDatabaseResource { + /** + * 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 properties property: Properties of Arc Sql Server database. + * + * @return the properties value. + */ + SqlServerDatabaseResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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.azurearcdata.fluent.models.SqlServerDatabaseResourceInner object. + * + * @return the inner object. + */ + SqlServerDatabaseResourceInner innerModel(); + + /** + * The entirety of the SqlServerDatabaseResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * The SqlServerDatabaseResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SqlServerDatabaseResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the SqlServerDatabaseResource 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. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the SqlServerDatabaseResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, sqlServerInstanceName. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @return the next definition stage. + */ + WithProperties withExistingSqlServerInstance(String resourceGroupName, String sqlServerInstanceName); + } + + /** + * The stage of the SqlServerDatabaseResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Properties of Arc Sql Server database. + * + * @param properties Properties of Arc Sql Server database. + * @return the next definition stage. + */ + WithCreate withProperties(SqlServerDatabaseResourceProperties properties); + } + + /** + * The stage of the SqlServerDatabaseResource 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlServerDatabaseResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlServerDatabaseResource create(Context context); + } + + /** + * The stage of the SqlServerDatabaseResource 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); + } + } + + /** + * Begins update for the SqlServerDatabaseResource resource. + * + * @return the stage of resource update. + */ + SqlServerDatabaseResource.Update update(); + + /** + * The template for SqlServerDatabaseResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlServerDatabaseResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlServerDatabaseResource apply(Context context); + } + + /** + * The SqlServerDatabaseResource update stages. + */ + interface UpdateStages { + /** + * The stage of the SqlServerDatabaseResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the SqlServerDatabaseResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The data controller's properties. + * + * @param properties The data controller's properties. + * @return the next definition stage. + */ + Update withProperties(SqlServerDatabaseResourceProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlServerDatabaseResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlServerDatabaseResource refresh(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourceProperties.java new file mode 100644 index 000000000000..08b39d2a521c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourceProperties.java @@ -0,0 +1,581 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The properties of Arc Sql Server database resource. + */ +@Fluent +public final class SqlServerDatabaseResourceProperties + implements JsonSerializable { + /* + * Collation of the database. + */ + private String collationName; + + /* + * Creation date of the database. + */ + private OffsetDateTime databaseCreationDate; + + /* + * Compatibility level of the database + */ + private Integer compatibilityLevel; + + /* + * Size of the database. + */ + private Float sizeMB; + + /* + * Space left of the database. + */ + private Float spaceAvailableMB; + + /* + * State of the database. + */ + private DatabaseState state; + + /* + * Whether the database is read only or not. + */ + private Boolean isReadOnly; + + /* + * Status of the database. + */ + private RecoveryMode recoveryMode; + + /* + * List of features that are enabled for the database + */ + private SqlServerDatabaseResourcePropertiesDatabaseOptions databaseOptions; + + /* + * The backupInformation property. + */ + private SqlServerDatabaseResourcePropertiesBackupInformation backupInformation; + + /* + * The backup profile for the SQL server. + */ + private BackupPolicy backupPolicy; + + /* + * This records the earliest start date and time that restore is available for this database (ISO8601 format). + */ + private OffsetDateTime earliestRestoreDate; + + /* + * Database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing + * database. sourceDatabaseId and restorePointInTime must be specified. + */ + private DatabaseCreateMode createMode; + + /* + * The name of the source database associated with create operation of this database. + */ + private String sourceDatabaseId; + + /* + * Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 + * format) of the source database that will be restored to create the new database. + */ + private OffsetDateTime restorePointInTime; + + /* + * The provisioning state of the Arc-enabled SQL Server database resource. + */ + private String provisioningState; + + /* + * The time when last successful database upload was performed. + */ + private OffsetDateTime lastDatabaseUploadTime; + + /* + * Migration related configuration. + */ + private DataBaseMigration migration; + + /** + * Creates an instance of SqlServerDatabaseResourceProperties class. + */ + public SqlServerDatabaseResourceProperties() { + } + + /** + * Get the collationName property: Collation of the database. + * + * @return the collationName value. + */ + public String collationName() { + return this.collationName; + } + + /** + * Set the collationName property: Collation of the database. + * + * @param collationName the collationName value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withCollationName(String collationName) { + this.collationName = collationName; + return this; + } + + /** + * Get the databaseCreationDate property: Creation date of the database. + * + * @return the databaseCreationDate value. + */ + public OffsetDateTime databaseCreationDate() { + return this.databaseCreationDate; + } + + /** + * Set the databaseCreationDate property: Creation date of the database. + * + * @param databaseCreationDate the databaseCreationDate value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withDatabaseCreationDate(OffsetDateTime databaseCreationDate) { + this.databaseCreationDate = databaseCreationDate; + return this; + } + + /** + * Get the compatibilityLevel property: Compatibility level of the database. + * + * @return the compatibilityLevel value. + */ + public Integer compatibilityLevel() { + return this.compatibilityLevel; + } + + /** + * Set the compatibilityLevel property: Compatibility level of the database. + * + * @param compatibilityLevel the compatibilityLevel value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withCompatibilityLevel(Integer compatibilityLevel) { + this.compatibilityLevel = compatibilityLevel; + return this; + } + + /** + * Get the sizeMB property: Size of the database. + * + * @return the sizeMB value. + */ + public Float sizeMB() { + return this.sizeMB; + } + + /** + * Set the sizeMB property: Size of the database. + * + * @param sizeMB the sizeMB value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withSizeMB(Float sizeMB) { + this.sizeMB = sizeMB; + return this; + } + + /** + * Get the spaceAvailableMB property: Space left of the database. + * + * @return the spaceAvailableMB value. + */ + public Float spaceAvailableMB() { + return this.spaceAvailableMB; + } + + /** + * Set the spaceAvailableMB property: Space left of the database. + * + * @param spaceAvailableMB the spaceAvailableMB value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withSpaceAvailableMB(Float spaceAvailableMB) { + this.spaceAvailableMB = spaceAvailableMB; + return this; + } + + /** + * Get the state property: State of the database. + * + * @return the state value. + */ + public DatabaseState state() { + return this.state; + } + + /** + * Set the state property: State of the database. + * + * @param state the state value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withState(DatabaseState state) { + this.state = state; + return this; + } + + /** + * Get the isReadOnly property: Whether the database is read only or not. + * + * @return the isReadOnly value. + */ + public Boolean isReadOnly() { + return this.isReadOnly; + } + + /** + * Set the isReadOnly property: Whether the database is read only or not. + * + * @param isReadOnly the isReadOnly value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withIsReadOnly(Boolean isReadOnly) { + this.isReadOnly = isReadOnly; + return this; + } + + /** + * Get the recoveryMode property: Status of the database. + * + * @return the recoveryMode value. + */ + public RecoveryMode recoveryMode() { + return this.recoveryMode; + } + + /** + * Set the recoveryMode property: Status of the database. + * + * @param recoveryMode the recoveryMode value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withRecoveryMode(RecoveryMode recoveryMode) { + this.recoveryMode = recoveryMode; + return this; + } + + /** + * Get the databaseOptions property: List of features that are enabled for the database. + * + * @return the databaseOptions value. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions databaseOptions() { + return this.databaseOptions; + } + + /** + * Set the databaseOptions property: List of features that are enabled for the database. + * + * @param databaseOptions the databaseOptions value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties + withDatabaseOptions(SqlServerDatabaseResourcePropertiesDatabaseOptions databaseOptions) { + this.databaseOptions = databaseOptions; + return this; + } + + /** + * Get the backupInformation property: The backupInformation property. + * + * @return the backupInformation value. + */ + public SqlServerDatabaseResourcePropertiesBackupInformation backupInformation() { + return this.backupInformation; + } + + /** + * Set the backupInformation property: The backupInformation property. + * + * @param backupInformation the backupInformation value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties + withBackupInformation(SqlServerDatabaseResourcePropertiesBackupInformation backupInformation) { + this.backupInformation = backupInformation; + return this; + } + + /** + * Get the backupPolicy property: The backup profile for the SQL server. + * + * @return the backupPolicy value. + */ + public BackupPolicy backupPolicy() { + return this.backupPolicy; + } + + /** + * Set the backupPolicy property: The backup profile for the SQL server. + * + * @param backupPolicy the backupPolicy value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withBackupPolicy(BackupPolicy backupPolicy) { + this.backupPolicy = backupPolicy; + return this; + } + + /** + * Get the earliestRestoreDate property: This records the earliest start date and time that restore is available for + * this database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the createMode property: Database create mode. PointInTimeRestore: Create a database by restoring a point in + * time backup of an existing database. sourceDatabaseId and restorePointInTime must be specified. + * + * @return the createMode value. + */ + public DatabaseCreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Database create mode. PointInTimeRestore: Create a database by restoring a point in + * time backup of an existing database. sourceDatabaseId and restorePointInTime must be specified. + * + * @param createMode the createMode value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withCreateMode(DatabaseCreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the sourceDatabaseId property: The name of the source database associated with create operation of this + * database. + * + * @return the sourceDatabaseId value. + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set the sourceDatabaseId property: The name of the source database associated with create operation of this + * database. + * + * @param sourceDatabaseId the sourceDatabaseId value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + * + * @param restorePointInTime the restorePointInTime value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the Arc-enabled SQL Server database resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the lastDatabaseUploadTime property: The time when last successful database upload was performed. + * + * @return the lastDatabaseUploadTime value. + */ + public OffsetDateTime lastDatabaseUploadTime() { + return this.lastDatabaseUploadTime; + } + + /** + * Get the migration property: Migration related configuration. + * + * @return the migration value. + */ + public DataBaseMigration migration() { + return this.migration; + } + + /** + * Set the migration property: Migration related configuration. + * + * @param migration the migration value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withMigration(DataBaseMigration migration) { + this.migration = migration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (databaseOptions() != null) { + databaseOptions().validate(); + } + if (backupInformation() != null) { + backupInformation().validate(); + } + if (backupPolicy() != null) { + backupPolicy().validate(); + } + if (migration() != null) { + migration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("collationName", this.collationName); + jsonWriter.writeStringField("databaseCreationDate", + this.databaseCreationDate == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.databaseCreationDate)); + jsonWriter.writeNumberField("compatibilityLevel", this.compatibilityLevel); + jsonWriter.writeNumberField("sizeMB", this.sizeMB); + jsonWriter.writeNumberField("spaceAvailableMB", this.spaceAvailableMB); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeBooleanField("isReadOnly", this.isReadOnly); + jsonWriter.writeStringField("recoveryMode", this.recoveryMode == null ? null : this.recoveryMode.toString()); + jsonWriter.writeJsonField("databaseOptions", this.databaseOptions); + jsonWriter.writeJsonField("backupInformation", this.backupInformation); + jsonWriter.writeJsonField("backupPolicy", this.backupPolicy); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + jsonWriter.writeStringField("sourceDatabaseId", this.sourceDatabaseId); + jsonWriter.writeStringField("restorePointInTime", + this.restorePointInTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.restorePointInTime)); + jsonWriter.writeJsonField("migration", this.migration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerDatabaseResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerDatabaseResourceProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerDatabaseResourceProperties. + */ + public static SqlServerDatabaseResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerDatabaseResourceProperties deserializedSqlServerDatabaseResourceProperties + = new SqlServerDatabaseResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("collationName".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.collationName = reader.getString(); + } else if ("databaseCreationDate".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.databaseCreationDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("compatibilityLevel".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.compatibilityLevel + = reader.getNullable(JsonReader::getInt); + } else if ("sizeMB".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.sizeMB = reader.getNullable(JsonReader::getFloat); + } else if ("spaceAvailableMB".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.spaceAvailableMB + = reader.getNullable(JsonReader::getFloat); + } else if ("state".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.state + = DatabaseState.fromString(reader.getString()); + } else if ("isReadOnly".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.isReadOnly + = reader.getNullable(JsonReader::getBoolean); + } else if ("recoveryMode".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.recoveryMode + = RecoveryMode.fromString(reader.getString()); + } else if ("databaseOptions".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.databaseOptions + = SqlServerDatabaseResourcePropertiesDatabaseOptions.fromJson(reader); + } else if ("backupInformation".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.backupInformation + = SqlServerDatabaseResourcePropertiesBackupInformation.fromJson(reader); + } else if ("backupPolicy".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.backupPolicy = BackupPolicy.fromJson(reader); + } else if ("earliestRestoreDate".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.earliestRestoreDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createMode".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.createMode + = DatabaseCreateMode.fromString(reader.getString()); + } else if ("sourceDatabaseId".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.sourceDatabaseId = reader.getString(); + } else if ("restorePointInTime".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.restorePointInTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.provisioningState = reader.getString(); + } else if ("lastDatabaseUploadTime".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.lastDatabaseUploadTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("migration".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.migration = DataBaseMigration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerDatabaseResourceProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesBackupInformation.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesBackupInformation.java new file mode 100644 index 000000000000..3c0ae6c79bd0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesBackupInformation.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The SqlServerDatabaseResourcePropertiesBackupInformation model. + */ +@Fluent +public final class SqlServerDatabaseResourcePropertiesBackupInformation + implements JsonSerializable { + /* + * Date time of last full backup. + */ + private OffsetDateTime lastFullBackup; + + /* + * Date time of last log backup. + */ + private OffsetDateTime lastLogBackup; + + /** + * Creates an instance of SqlServerDatabaseResourcePropertiesBackupInformation class. + */ + public SqlServerDatabaseResourcePropertiesBackupInformation() { + } + + /** + * Get the lastFullBackup property: Date time of last full backup. + * + * @return the lastFullBackup value. + */ + public OffsetDateTime lastFullBackup() { + return this.lastFullBackup; + } + + /** + * Set the lastFullBackup property: Date time of last full backup. + * + * @param lastFullBackup the lastFullBackup value to set. + * @return the SqlServerDatabaseResourcePropertiesBackupInformation object itself. + */ + public SqlServerDatabaseResourcePropertiesBackupInformation withLastFullBackup(OffsetDateTime lastFullBackup) { + this.lastFullBackup = lastFullBackup; + return this; + } + + /** + * Get the lastLogBackup property: Date time of last log backup. + * + * @return the lastLogBackup value. + */ + public OffsetDateTime lastLogBackup() { + return this.lastLogBackup; + } + + /** + * Set the lastLogBackup property: Date time of last log backup. + * + * @param lastLogBackup the lastLogBackup value to set. + * @return the SqlServerDatabaseResourcePropertiesBackupInformation object itself. + */ + public SqlServerDatabaseResourcePropertiesBackupInformation withLastLogBackup(OffsetDateTime lastLogBackup) { + this.lastLogBackup = lastLogBackup; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("lastFullBackup", + this.lastFullBackup == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastFullBackup)); + jsonWriter.writeStringField("lastLogBackup", + this.lastLogBackup == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastLogBackup)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerDatabaseResourcePropertiesBackupInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerDatabaseResourcePropertiesBackupInformation if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerDatabaseResourcePropertiesBackupInformation. + */ + public static SqlServerDatabaseResourcePropertiesBackupInformation fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerDatabaseResourcePropertiesBackupInformation deserializedSqlServerDatabaseResourcePropertiesBackupInformation + = new SqlServerDatabaseResourcePropertiesBackupInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("lastFullBackup".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesBackupInformation.lastFullBackup = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastLogBackup".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesBackupInformation.lastLogBackup = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerDatabaseResourcePropertiesBackupInformation; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesDatabaseOptions.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesDatabaseOptions.java new file mode 100644 index 000000000000..8f734c306416 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesDatabaseOptions.java @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * List of features that are enabled for the database. + */ +@Fluent +public final class SqlServerDatabaseResourcePropertiesDatabaseOptions + implements JsonSerializable { + /* + * The isAutoCloseOn property. + */ + private Boolean isAutoCloseOn; + + /* + * The isAutoShrinkOn property. + */ + private Boolean isAutoShrinkOn; + + /* + * The isAutoCreateStatsOn property. + */ + private Boolean isAutoCreateStatsOn; + + /* + * The isAutoUpdateStatsOn property. + */ + private Boolean isAutoUpdateStatsOn; + + /* + * The isRemoteDataArchiveEnabled property. + */ + private Boolean isRemoteDataArchiveEnabled; + + /* + * The isMemoryOptimizationEnabled property. + */ + private Boolean isMemoryOptimizationEnabled; + + /* + * The isEncrypted property. + */ + private Boolean isEncrypted; + + /* + * The isTrustworthyOn property. + */ + private Boolean isTrustworthyOn; + + /** + * Creates an instance of SqlServerDatabaseResourcePropertiesDatabaseOptions class. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions() { + } + + /** + * Get the isAutoCloseOn property: The isAutoCloseOn property. + * + * @return the isAutoCloseOn value. + */ + public Boolean isAutoCloseOn() { + return this.isAutoCloseOn; + } + + /** + * Set the isAutoCloseOn property: The isAutoCloseOn property. + * + * @param isAutoCloseOn the isAutoCloseOn value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions withIsAutoCloseOn(Boolean isAutoCloseOn) { + this.isAutoCloseOn = isAutoCloseOn; + return this; + } + + /** + * Get the isAutoShrinkOn property: The isAutoShrinkOn property. + * + * @return the isAutoShrinkOn value. + */ + public Boolean isAutoShrinkOn() { + return this.isAutoShrinkOn; + } + + /** + * Set the isAutoShrinkOn property: The isAutoShrinkOn property. + * + * @param isAutoShrinkOn the isAutoShrinkOn value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions withIsAutoShrinkOn(Boolean isAutoShrinkOn) { + this.isAutoShrinkOn = isAutoShrinkOn; + return this; + } + + /** + * Get the isAutoCreateStatsOn property: The isAutoCreateStatsOn property. + * + * @return the isAutoCreateStatsOn value. + */ + public Boolean isAutoCreateStatsOn() { + return this.isAutoCreateStatsOn; + } + + /** + * Set the isAutoCreateStatsOn property: The isAutoCreateStatsOn property. + * + * @param isAutoCreateStatsOn the isAutoCreateStatsOn value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions withIsAutoCreateStatsOn(Boolean isAutoCreateStatsOn) { + this.isAutoCreateStatsOn = isAutoCreateStatsOn; + return this; + } + + /** + * Get the isAutoUpdateStatsOn property: The isAutoUpdateStatsOn property. + * + * @return the isAutoUpdateStatsOn value. + */ + public Boolean isAutoUpdateStatsOn() { + return this.isAutoUpdateStatsOn; + } + + /** + * Set the isAutoUpdateStatsOn property: The isAutoUpdateStatsOn property. + * + * @param isAutoUpdateStatsOn the isAutoUpdateStatsOn value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions withIsAutoUpdateStatsOn(Boolean isAutoUpdateStatsOn) { + this.isAutoUpdateStatsOn = isAutoUpdateStatsOn; + return this; + } + + /** + * Get the isRemoteDataArchiveEnabled property: The isRemoteDataArchiveEnabled property. + * + * @return the isRemoteDataArchiveEnabled value. + */ + public Boolean isRemoteDataArchiveEnabled() { + return this.isRemoteDataArchiveEnabled; + } + + /** + * Set the isRemoteDataArchiveEnabled property: The isRemoteDataArchiveEnabled property. + * + * @param isRemoteDataArchiveEnabled the isRemoteDataArchiveEnabled value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions + withIsRemoteDataArchiveEnabled(Boolean isRemoteDataArchiveEnabled) { + this.isRemoteDataArchiveEnabled = isRemoteDataArchiveEnabled; + return this; + } + + /** + * Get the isMemoryOptimizationEnabled property: The isMemoryOptimizationEnabled property. + * + * @return the isMemoryOptimizationEnabled value. + */ + public Boolean isMemoryOptimizationEnabled() { + return this.isMemoryOptimizationEnabled; + } + + /** + * Set the isMemoryOptimizationEnabled property: The isMemoryOptimizationEnabled property. + * + * @param isMemoryOptimizationEnabled the isMemoryOptimizationEnabled value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions + withIsMemoryOptimizationEnabled(Boolean isMemoryOptimizationEnabled) { + this.isMemoryOptimizationEnabled = isMemoryOptimizationEnabled; + return this; + } + + /** + * Get the isEncrypted property: The isEncrypted property. + * + * @return the isEncrypted value. + */ + public Boolean isEncrypted() { + return this.isEncrypted; + } + + /** + * Set the isEncrypted property: The isEncrypted property. + * + * @param isEncrypted the isEncrypted value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions withIsEncrypted(Boolean isEncrypted) { + this.isEncrypted = isEncrypted; + return this; + } + + /** + * Get the isTrustworthyOn property: The isTrustworthyOn property. + * + * @return the isTrustworthyOn value. + */ + public Boolean isTrustworthyOn() { + return this.isTrustworthyOn; + } + + /** + * Set the isTrustworthyOn property: The isTrustworthyOn property. + * + * @param isTrustworthyOn the isTrustworthyOn value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions withIsTrustworthyOn(Boolean isTrustworthyOn) { + this.isTrustworthyOn = isTrustworthyOn; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isAutoCloseOn", this.isAutoCloseOn); + jsonWriter.writeBooleanField("isAutoShrinkOn", this.isAutoShrinkOn); + jsonWriter.writeBooleanField("isAutoCreateStatsOn", this.isAutoCreateStatsOn); + jsonWriter.writeBooleanField("isAutoUpdateStatsOn", this.isAutoUpdateStatsOn); + jsonWriter.writeBooleanField("isRemoteDataArchiveEnabled", this.isRemoteDataArchiveEnabled); + jsonWriter.writeBooleanField("isMemoryOptimizationEnabled", this.isMemoryOptimizationEnabled); + jsonWriter.writeBooleanField("isEncrypted", this.isEncrypted); + jsonWriter.writeBooleanField("isTrustworthyOn", this.isTrustworthyOn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerDatabaseResourcePropertiesDatabaseOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerDatabaseResourcePropertiesDatabaseOptions if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerDatabaseResourcePropertiesDatabaseOptions. + */ + public static SqlServerDatabaseResourcePropertiesDatabaseOptions fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerDatabaseResourcePropertiesDatabaseOptions deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions + = new SqlServerDatabaseResourcePropertiesDatabaseOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isAutoCloseOn".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isAutoCloseOn + = reader.getNullable(JsonReader::getBoolean); + } else if ("isAutoShrinkOn".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isAutoShrinkOn + = reader.getNullable(JsonReader::getBoolean); + } else if ("isAutoCreateStatsOn".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isAutoCreateStatsOn + = reader.getNullable(JsonReader::getBoolean); + } else if ("isAutoUpdateStatsOn".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isAutoUpdateStatsOn + = reader.getNullable(JsonReader::getBoolean); + } else if ("isRemoteDataArchiveEnabled".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isRemoteDataArchiveEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("isMemoryOptimizationEnabled".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isMemoryOptimizationEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("isEncrypted".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isEncrypted + = reader.getNullable(JsonReader::getBoolean); + } else if ("isTrustworthyOn".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isTrustworthyOn + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseUpdate.java new file mode 100644 index 000000000000..7521a3a095dd --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseUpdate.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * An update to database resource. + */ +@Fluent +public final class SqlServerDatabaseUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * The data controller's properties + */ + private SqlServerDatabaseResourceProperties properties; + + /** + * Creates an instance of SqlServerDatabaseUpdate class. + */ + public SqlServerDatabaseUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the SqlServerDatabaseUpdate object itself. + */ + public SqlServerDatabaseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The data controller's properties. + * + * @return the properties value. + */ + public SqlServerDatabaseResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The data controller's properties. + * + * @param properties the properties value to set. + * @return the SqlServerDatabaseUpdate object itself. + */ + public SqlServerDatabaseUpdate withProperties(SqlServerDatabaseResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerDatabaseUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerDatabaseUpdate if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerDatabaseUpdate. + */ + public static SqlServerDatabaseUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerDatabaseUpdate deserializedSqlServerDatabaseUpdate = new SqlServerDatabaseUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerDatabaseUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedSqlServerDatabaseUpdate.properties + = SqlServerDatabaseResourceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerDatabaseUpdate; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabases.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabases.java new file mode 100644 index 000000000000..0fb954b27664 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabases.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.azurearcdata.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 SqlServerDatabases. + */ +public interface SqlServerDatabases { + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName); + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName, Context context); + + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String sqlServerInstanceName, + String databaseName, Context context); + + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database. + */ + SqlServerDatabaseResource get(String resourceGroupName, String sqlServerInstanceName, String databaseName); + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String sqlServerInstanceName); + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String sqlServerInstanceName, + Context context); + + /** + * Retrieves an Arc Sql Server database. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response}. + */ + SqlServerDatabaseResource getById(String id); + + /** + * Retrieves an Arc Sql Server database. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an Arc Sql Server database resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an Arc Sql Server database resource. + * + * @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 SqlServerDatabaseResource resource. + * + * @param name resource name. + * @return the first stage of the new SqlServerDatabaseResource definition. + */ + SqlServerDatabaseResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicense.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicense.java new file mode 100644 index 000000000000..4cdf26b370d3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicense.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerEsuLicenseInner; +import java.util.Map; + +/** + * An immutable client-side representation of SqlServerEsuLicense. + */ +public interface SqlServerEsuLicense { + /** + * 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 properties property: SQL Server ESU license properties. + * + * @return the properties value. + */ + SqlServerEsuLicenseProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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.azurearcdata.fluent.models.SqlServerEsuLicenseInner object. + * + * @return the inner object. + */ + SqlServerEsuLicenseInner innerModel(); + + /** + * The entirety of the SqlServerEsuLicense definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * The SqlServerEsuLicense definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SqlServerEsuLicense definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the SqlServerEsuLicense 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 SqlServerEsuLicense 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. + */ + WithProperties withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the SqlServerEsuLicense definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: SQL Server ESU license properties. + * + * @param properties SQL Server ESU license properties. + * @return the next definition stage. + */ + WithCreate withProperties(SqlServerEsuLicenseProperties properties); + } + + /** + * The stage of the SqlServerEsuLicense 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlServerEsuLicense create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlServerEsuLicense create(Context context); + } + + /** + * The stage of the SqlServerEsuLicense 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); + } + } + + /** + * Begins update for the SqlServerEsuLicense resource. + * + * @return the stage of resource update. + */ + SqlServerEsuLicense.Update update(); + + /** + * The template for SqlServerEsuLicense update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlServerEsuLicense apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlServerEsuLicense apply(Context context); + } + + /** + * The SqlServerEsuLicense update stages. + */ + interface UpdateStages { + /** + * The stage of the SqlServerEsuLicense update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the SqlServerEsuLicense update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: null. + * + * @param properties null. + * @return the next definition stage. + */ + Update withProperties(SqlServerEsuLicenseUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlServerEsuLicense refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlServerEsuLicense refresh(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseListResult.java new file mode 100644 index 000000000000..f2cfed18ad7d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseListResult.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerEsuLicenseInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of SQL Server ESU licenses. + */ +@Immutable +public final class SqlServerEsuLicenseListResult implements JsonSerializable { + /* + * Array of results. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of SqlServerEsuLicenseListResult class. + */ + public SqlServerEsuLicenseListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerEsuLicenseListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerEsuLicenseListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerEsuLicenseListResult. + */ + public static SqlServerEsuLicenseListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerEsuLicenseListResult deserializedSqlServerEsuLicenseListResult + = new SqlServerEsuLicenseListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlServerEsuLicenseInner.fromJson(reader1)); + deserializedSqlServerEsuLicenseListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSqlServerEsuLicenseListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerEsuLicenseListResult; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseProperties.java new file mode 100644 index 000000000000..26ef34dc07a6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseProperties.java @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Properties of SQL Server ESU license. + */ +@Fluent +public final class SqlServerEsuLicenseProperties implements JsonSerializable { + /* + * SQL Server ESU license type. + */ + private BillingPlan billingPlan; + + /* + * The SQL Server version the license covers. + */ + private Version version; + + /* + * The unique ID of this license. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + */ + private String uniqueId; + + /* + * The number of total cores of the license covers. + */ + private int physicalCores; + + /* + * The activation state of the license. + */ + private State activationState; + + /* + * The Azure scope to which the license will apply. + */ + private ScopeType scopeType; + + /* + * The timestamp of the activation of the SqlServerEsuLicense in ISO 8601 date-time format. + */ + private OffsetDateTime activatedAt; + + /* + * The timestamp of the termination of the SqlServerEsuLicense in ISO 8601 date-time format. + */ + private OffsetDateTime terminatedAt; + + /* + * The tenantId the SQL Server ESU license resource subscription resides in. + */ + private String tenantId; + + /** + * Creates an instance of SqlServerEsuLicenseProperties class. + */ + public SqlServerEsuLicenseProperties() { + } + + /** + * Get the billingPlan property: SQL Server ESU license type. + * + * @return the billingPlan value. + */ + public BillingPlan billingPlan() { + return this.billingPlan; + } + + /** + * Set the billingPlan property: SQL Server ESU license type. + * + * @param billingPlan the billingPlan value to set. + * @return the SqlServerEsuLicenseProperties object itself. + */ + public SqlServerEsuLicenseProperties withBillingPlan(BillingPlan billingPlan) { + this.billingPlan = billingPlan; + return this; + } + + /** + * Get the version property: The SQL Server version the license covers. + * + * @return the version value. + */ + public Version version() { + return this.version; + } + + /** + * Set the version property: The SQL Server version the license covers. + * + * @param version the version value to set. + * @return the SqlServerEsuLicenseProperties object itself. + */ + public SqlServerEsuLicenseProperties withVersion(Version version) { + this.version = version; + return this; + } + + /** + * Get the uniqueId property: The unique ID of this license. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.uniqueId; + } + + /** + * Get the physicalCores property: The number of total cores of the license covers. + * + * @return the physicalCores value. + */ + public int physicalCores() { + return this.physicalCores; + } + + /** + * Set the physicalCores property: The number of total cores of the license covers. + * + * @param physicalCores the physicalCores value to set. + * @return the SqlServerEsuLicenseProperties object itself. + */ + public SqlServerEsuLicenseProperties withPhysicalCores(int physicalCores) { + this.physicalCores = physicalCores; + return this; + } + + /** + * Get the activationState property: The activation state of the license. + * + * @return the activationState value. + */ + public State activationState() { + return this.activationState; + } + + /** + * Set the activationState property: The activation state of the license. + * + * @param activationState the activationState value to set. + * @return the SqlServerEsuLicenseProperties object itself. + */ + public SqlServerEsuLicenseProperties withActivationState(State activationState) { + this.activationState = activationState; + return this; + } + + /** + * Get the scopeType property: The Azure scope to which the license will apply. + * + * @return the scopeType value. + */ + public ScopeType scopeType() { + return this.scopeType; + } + + /** + * Set the scopeType property: The Azure scope to which the license will apply. + * + * @param scopeType the scopeType value to set. + * @return the SqlServerEsuLicenseProperties object itself. + */ + public SqlServerEsuLicenseProperties withScopeType(ScopeType scopeType) { + this.scopeType = scopeType; + return this; + } + + /** + * Get the activatedAt property: The timestamp of the activation of the SqlServerEsuLicense in ISO 8601 date-time + * format. + * + * @return the activatedAt value. + */ + public OffsetDateTime activatedAt() { + return this.activatedAt; + } + + /** + * Get the terminatedAt property: The timestamp of the termination of the SqlServerEsuLicense in ISO 8601 date-time + * format. + * + * @return the terminatedAt value. + */ + public OffsetDateTime terminatedAt() { + return this.terminatedAt; + } + + /** + * Get the tenantId property: The tenantId the SQL Server ESU license resource subscription resides in. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (billingPlan() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property billingPlan in model SqlServerEsuLicenseProperties")); + } + if (version() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property version in model SqlServerEsuLicenseProperties")); + } + if (activationState() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property activationState in model SqlServerEsuLicenseProperties")); + } + if (scopeType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property scopeType in model SqlServerEsuLicenseProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlServerEsuLicenseProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("billingPlan", this.billingPlan == null ? null : this.billingPlan.toString()); + jsonWriter.writeStringField("version", this.version == null ? null : this.version.toString()); + jsonWriter.writeIntField("physicalCores", this.physicalCores); + jsonWriter.writeStringField("activationState", + this.activationState == null ? null : this.activationState.toString()); + jsonWriter.writeStringField("scopeType", this.scopeType == null ? null : this.scopeType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerEsuLicenseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerEsuLicenseProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerEsuLicenseProperties. + */ + public static SqlServerEsuLicenseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerEsuLicenseProperties deserializedSqlServerEsuLicenseProperties + = new SqlServerEsuLicenseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("billingPlan".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.billingPlan = BillingPlan.fromString(reader.getString()); + } else if ("version".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.version = Version.fromString(reader.getString()); + } else if ("physicalCores".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.physicalCores = reader.getInt(); + } else if ("activationState".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.activationState = State.fromString(reader.getString()); + } else if ("scopeType".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.scopeType = ScopeType.fromString(reader.getString()); + } else if ("uniqueId".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.uniqueId = reader.getString(); + } else if ("activatedAt".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.activatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("terminatedAt".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.terminatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.tenantId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerEsuLicenseProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseUpdate.java new file mode 100644 index 000000000000..66ace83bd51c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseUpdate.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * An update to a SQL Server ESU license resource. + */ +@Fluent +public final class SqlServerEsuLicenseUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * null + */ + private SqlServerEsuLicenseUpdateProperties properties; + + /** + * Creates an instance of SqlServerEsuLicenseUpdate class. + */ + public SqlServerEsuLicenseUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the SqlServerEsuLicenseUpdate object itself. + */ + public SqlServerEsuLicenseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: null. + * + * @return the properties value. + */ + public SqlServerEsuLicenseUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: null. + * + * @param properties the properties value to set. + * @return the SqlServerEsuLicenseUpdate object itself. + */ + public SqlServerEsuLicenseUpdate withProperties(SqlServerEsuLicenseUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerEsuLicenseUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerEsuLicenseUpdate if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerEsuLicenseUpdate. + */ + public static SqlServerEsuLicenseUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerEsuLicenseUpdate deserializedSqlServerEsuLicenseUpdate = new SqlServerEsuLicenseUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerEsuLicenseUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdate.properties + = SqlServerEsuLicenseUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerEsuLicenseUpdate; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseUpdateProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseUpdateProperties.java new file mode 100644 index 000000000000..8814614a2fc2 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseUpdateProperties.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.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Properties of update SqlServerEsuLicense. + */ +@Fluent +public final class SqlServerEsuLicenseUpdateProperties + implements JsonSerializable { + /* + * SQL Server ESU license type. + */ + private BillingPlan billingPlan; + + /* + * The SQL Server version the license covers. + */ + private Version version; + + /* + * The unique ID of this license. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + */ + private String uniqueId; + + /* + * The number of total cores of the license covers. + */ + private Integer physicalCores; + + /* + * The activation state of the license. + */ + private State activationState; + + /* + * The Azure scope to which the license will apply. + */ + private ScopeType scopeType; + + /* + * The timestamp of the activation of the SqlServerEsuLicense in ISO 8601 date-time format. + */ + private OffsetDateTime activatedAt; + + /* + * The timestamp of the termination of the SqlServerEsuLicense in ISO 8601 date-time format. + */ + private OffsetDateTime terminatedAt; + + /* + * The tenantId the SQL Server ESU license resource subscription resides in. + */ + private String tenantId; + + /** + * Creates an instance of SqlServerEsuLicenseUpdateProperties class. + */ + public SqlServerEsuLicenseUpdateProperties() { + } + + /** + * Get the billingPlan property: SQL Server ESU license type. + * + * @return the billingPlan value. + */ + public BillingPlan billingPlan() { + return this.billingPlan; + } + + /** + * Set the billingPlan property: SQL Server ESU license type. + * + * @param billingPlan the billingPlan value to set. + * @return the SqlServerEsuLicenseUpdateProperties object itself. + */ + public SqlServerEsuLicenseUpdateProperties withBillingPlan(BillingPlan billingPlan) { + this.billingPlan = billingPlan; + return this; + } + + /** + * Get the version property: The SQL Server version the license covers. + * + * @return the version value. + */ + public Version version() { + return this.version; + } + + /** + * Set the version property: The SQL Server version the license covers. + * + * @param version the version value to set. + * @return the SqlServerEsuLicenseUpdateProperties object itself. + */ + public SqlServerEsuLicenseUpdateProperties withVersion(Version version) { + this.version = version; + return this; + } + + /** + * Get the uniqueId property: The unique ID of this license. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.uniqueId; + } + + /** + * Get the physicalCores property: The number of total cores of the license covers. + * + * @return the physicalCores value. + */ + public Integer physicalCores() { + return this.physicalCores; + } + + /** + * Set the physicalCores property: The number of total cores of the license covers. + * + * @param physicalCores the physicalCores value to set. + * @return the SqlServerEsuLicenseUpdateProperties object itself. + */ + public SqlServerEsuLicenseUpdateProperties withPhysicalCores(Integer physicalCores) { + this.physicalCores = physicalCores; + return this; + } + + /** + * Get the activationState property: The activation state of the license. + * + * @return the activationState value. + */ + public State activationState() { + return this.activationState; + } + + /** + * Set the activationState property: The activation state of the license. + * + * @param activationState the activationState value to set. + * @return the SqlServerEsuLicenseUpdateProperties object itself. + */ + public SqlServerEsuLicenseUpdateProperties withActivationState(State activationState) { + this.activationState = activationState; + return this; + } + + /** + * Get the scopeType property: The Azure scope to which the license will apply. + * + * @return the scopeType value. + */ + public ScopeType scopeType() { + return this.scopeType; + } + + /** + * Set the scopeType property: The Azure scope to which the license will apply. + * + * @param scopeType the scopeType value to set. + * @return the SqlServerEsuLicenseUpdateProperties object itself. + */ + public SqlServerEsuLicenseUpdateProperties withScopeType(ScopeType scopeType) { + this.scopeType = scopeType; + return this; + } + + /** + * Get the activatedAt property: The timestamp of the activation of the SqlServerEsuLicense in ISO 8601 date-time + * format. + * + * @return the activatedAt value. + */ + public OffsetDateTime activatedAt() { + return this.activatedAt; + } + + /** + * Get the terminatedAt property: The timestamp of the termination of the SqlServerEsuLicense in ISO 8601 date-time + * format. + * + * @return the terminatedAt value. + */ + public OffsetDateTime terminatedAt() { + return this.terminatedAt; + } + + /** + * Get the tenantId property: The tenantId the SQL Server ESU license resource subscription resides in. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("billingPlan", this.billingPlan == null ? null : this.billingPlan.toString()); + jsonWriter.writeStringField("version", this.version == null ? null : this.version.toString()); + jsonWriter.writeNumberField("physicalCores", this.physicalCores); + jsonWriter.writeStringField("activationState", + this.activationState == null ? null : this.activationState.toString()); + jsonWriter.writeStringField("scopeType", this.scopeType == null ? null : this.scopeType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerEsuLicenseUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerEsuLicenseUpdateProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerEsuLicenseUpdateProperties. + */ + public static SqlServerEsuLicenseUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerEsuLicenseUpdateProperties deserializedSqlServerEsuLicenseUpdateProperties + = new SqlServerEsuLicenseUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("billingPlan".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.billingPlan + = BillingPlan.fromString(reader.getString()); + } else if ("version".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.version = Version.fromString(reader.getString()); + } else if ("uniqueId".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.uniqueId = reader.getString(); + } else if ("physicalCores".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.physicalCores + = reader.getNullable(JsonReader::getInt); + } else if ("activationState".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.activationState + = State.fromString(reader.getString()); + } else if ("scopeType".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.scopeType + = ScopeType.fromString(reader.getString()); + } else if ("activatedAt".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.activatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("terminatedAt".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.terminatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.tenantId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerEsuLicenseUpdateProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenses.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenses.java new file mode 100644 index 000000000000..b374c89cea83 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenses.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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 SqlServerEsuLicenses. + */ +public interface SqlServerEsuLicenses { + /** + * List sqlServerEsuLicense resources in the 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 SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List sqlServerEsuLicense resources in the 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 SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses 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 all sqlServerEsuLicenses in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses 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 all sqlServerEsuLicenses in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerEsuLicenseName, Context context); + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource. + */ + SqlServerEsuLicense getByResourceGroup(String resourceGroupName, String sqlServerEsuLicenseName); + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String sqlServerEsuLicenseName, + Context context); + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 sqlServerEsuLicenseName); + + /** + * Retrieves a SQL Server ESU license resource. + * + * @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 describe SQL Server ESU license resource along with {@link Response}. + */ + SqlServerEsuLicense getById(String id); + + /** + * Retrieves a SQL Server ESU license resource. + * + * @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 describe SQL Server ESU license resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a SQL Server ESU license resource. + * + * @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 SQL Server ESU license resource. + * + * @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 the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SqlServerEsuLicense resource. + * + * @param name resource name. + * @return the first stage of the new SqlServerEsuLicense definition. + */ + SqlServerEsuLicense.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstance.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstance.java index 01c74102532e..217e654648a3 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstance.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstance.java @@ -4,108 +4,120 @@ package com.azure.resourcemanager.azurearcdata.models; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; import com.azure.core.management.Region; import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceInner; +import java.util.List; import java.util.Map; -/** An immutable client-side representation of SqlServerInstance. */ +/** + * An immutable client-side representation of SqlServerInstance. + */ public interface SqlServerInstance { /** * 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 properties property: null. - * + * * @return the properties value. */ SqlServerInstanceProperties properties(); /** - * Gets the systemData property: Read only system data. - * + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * * @return the systemData value. */ SystemData systemData(); /** * 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.azurearcdata.fluent.models.SqlServerInstanceInner object. - * + * * @return the inner object. */ SqlServerInstanceInner innerModel(); - /** The entirety of the SqlServerInstance definition. */ - interface Definition - extends DefinitionStages.Blank, - DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, - DefinitionStages.WithCreate { + /** + * The entirety of the SqlServerInstance definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { } - /** The SqlServerInstance definition stages. */ + + /** + * The SqlServerInstance definition stages. + */ interface DefinitionStages { - /** The first stage of the SqlServerInstance definition. */ + /** + * The first stage of the SqlServerInstance definition. + */ interface Blank extends WithLocation { } - /** The stage of the SqlServerInstance definition allowing to specify location. */ + + /** + * The stage of the SqlServerInstance 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. */ @@ -113,22 +125,26 @@ interface WithLocation { /** * 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 SqlServerInstance definition allowing to specify parent resource. */ + + /** + * The stage of the SqlServerInstance definition allowing to specify parent resource. + */ interface WithResourceGroup { /** * Specifies resourceGroupName. - * + * * @param resourceGroupName The name of the Azure resource group. * @return the next definition stage. */ WithCreate withExistingResourceGroup(String resourceGroupName); } + /** * The stage of the SqlServerInstance 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. @@ -136,89 +152,225 @@ interface WithResourceGroup { interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { /** * Executes the create request. - * + * * @return the created resource. */ SqlServerInstance create(); /** * Executes the create request. - * + * * @param context The context to associate with this operation. * @return the created resource. */ SqlServerInstance create(Context context); } - /** The stage of the SqlServerInstance definition allowing to specify tags. */ + + /** + * The stage of the SqlServerInstance 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 SqlServerInstance definition allowing to specify properties. */ + + /** + * The stage of the SqlServerInstance definition allowing to specify properties. + */ interface WithProperties { /** * Specifies the properties property: null. - * + * * @param properties null. * @return the next definition stage. */ WithCreate withProperties(SqlServerInstanceProperties properties); } } + /** * Begins update for the SqlServerInstance resource. - * + * * @return the stage of resource update. */ SqlServerInstance.Update update(); - /** The template for SqlServerInstance update. */ - interface Update extends UpdateStages.WithTags { + /** + * The template for SqlServerInstance update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { /** * Executes the update request. - * + * * @return the updated resource. */ SqlServerInstance apply(); /** * Executes the update request. - * + * * @param context The context to associate with this operation. * @return the updated resource. */ SqlServerInstance apply(Context context); } - /** The SqlServerInstance update stages. */ + + /** + * The SqlServerInstance update stages. + */ interface UpdateStages { - /** The stage of the SqlServerInstance update allowing to specify tags. */ + /** + * The stage of the SqlServerInstance update allowing to specify tags. + */ interface WithTags { /** * Specifies the tags property: Resource tags.. - * + * * @param tags Resource tags. * @return the next definition stage. */ Update withTags(Map tags); } + + /** + * The stage of the SqlServerInstance update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: null. + * + * @param properties null. + * @return the next definition stage. + */ + Update withProperties(SqlServerInstanceUpdateProperties properties); + } } + /** * Refreshes the resource to sync with Azure. - * + * * @return the refreshed resource. */ SqlServerInstance refresh(); /** * Refreshes the resource to sync with Azure. - * + * * @param context The context to associate with this operation. * @return the refreshed resource. */ SqlServerInstance refresh(Context context); + + /** + * Retrieves SQL Server instance telemetry. + * + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a section of the telemetry response for the SQL Server instance as paginated response with + * {@link PagedIterable}. + */ + PagedIterable> getTelemetry(SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest); + + /** + * Retrieves SQL Server instance telemetry. + * + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a section of the telemetry response for the SQL Server instance as paginated response with + * {@link PagedIterable}. + */ + PagedIterable> getTelemetry(SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, + Context context); + + /** + * Runs migration assessment for SQL Server instance. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance along with {@link Response}. + */ + Response runMigrationAssessmentWithResponse(Context context); + + /** + * Runs migration assessment for SQL Server instance. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance. + */ + SqlServerInstanceRunMigrationAssessmentResponse runMigrationAssessment(); + + /** + * Gets jobs status details for sql arc resource. + * + * @param sqlServerInstanceJobsStatusRequest Contains the parameters to get SQL Server instance agent jobs status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource along with {@link Response}. + */ + Response getJobsStatusWithResponse( + SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest, Context context); + + /** + * Gets jobs status details for sql arc resource. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource. + */ + SqlServerInstanceJobsStatusResponse getJobsStatus(); + + /** + * Request Upgrade Permission before upgrading. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + Response preUpgradeWithResponse(Context context); + + /** + * Request Upgrade Permission before upgrading. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + SqlServerInstance preUpgrade(); + + /** + * Clean up after upgrading. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + Response postUpgradeWithResponse(Context context); + + /** + * Clean up after upgrading. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + SqlServerInstance postUpgrade(); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobStatus.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobStatus.java new file mode 100644 index 000000000000..50dac6fc2c6d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobStatus.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The status of the job running on the SQL Server instance. + */ +@Fluent +public final class SqlServerInstanceJobStatus implements JsonSerializable { + /* + * The unique identifier of the job. + */ + private String id; + + /* + * The name of the SQL Server instance. + */ + private String instanceName; + + /* + * The status of the job. + */ + private JobStatus jobStatus; + + /* + * The exception message if the job failed. + */ + private String jobException; + + /* + * The background job details. + */ + private BackgroundJob backgroundJob; + + /* + * The list of sequencer actions. + */ + private List sequencerActions; + + /** + * Creates an instance of SqlServerInstanceJobStatus class. + */ + public SqlServerInstanceJobStatus() { + } + + /** + * Get the id property: The unique identifier of the job. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The unique identifier of the job. + * + * @param id the id value to set. + * @return the SqlServerInstanceJobStatus object itself. + */ + public SqlServerInstanceJobStatus withId(String id) { + this.id = id; + return this; + } + + /** + * Get the instanceName property: The name of the SQL Server instance. + * + * @return the instanceName value. + */ + public String instanceName() { + return this.instanceName; + } + + /** + * Set the instanceName property: The name of the SQL Server instance. + * + * @param instanceName the instanceName value to set. + * @return the SqlServerInstanceJobStatus object itself. + */ + public SqlServerInstanceJobStatus withInstanceName(String instanceName) { + this.instanceName = instanceName; + return this; + } + + /** + * Get the jobStatus property: The status of the job. + * + * @return the jobStatus value. + */ + public JobStatus jobStatus() { + return this.jobStatus; + } + + /** + * Set the jobStatus property: The status of the job. + * + * @param jobStatus the jobStatus value to set. + * @return the SqlServerInstanceJobStatus object itself. + */ + public SqlServerInstanceJobStatus withJobStatus(JobStatus jobStatus) { + this.jobStatus = jobStatus; + return this; + } + + /** + * Get the jobException property: The exception message if the job failed. + * + * @return the jobException value. + */ + public String jobException() { + return this.jobException; + } + + /** + * Set the jobException property: The exception message if the job failed. + * + * @param jobException the jobException value to set. + * @return the SqlServerInstanceJobStatus object itself. + */ + public SqlServerInstanceJobStatus withJobException(String jobException) { + this.jobException = jobException; + return this; + } + + /** + * Get the backgroundJob property: The background job details. + * + * @return the backgroundJob value. + */ + public BackgroundJob backgroundJob() { + return this.backgroundJob; + } + + /** + * Set the backgroundJob property: The background job details. + * + * @param backgroundJob the backgroundJob value to set. + * @return the SqlServerInstanceJobStatus object itself. + */ + public SqlServerInstanceJobStatus withBackgroundJob(BackgroundJob backgroundJob) { + this.backgroundJob = backgroundJob; + return this; + } + + /** + * Get the sequencerActions property: The list of sequencer actions. + * + * @return the sequencerActions value. + */ + public List sequencerActions() { + return this.sequencerActions; + } + + /** + * Set the sequencerActions property: The list of sequencer actions. + * + * @param sequencerActions the sequencerActions value to set. + * @return the SqlServerInstanceJobStatus object itself. + */ + public SqlServerInstanceJobStatus withSequencerActions(List sequencerActions) { + this.sequencerActions = sequencerActions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (backgroundJob() != null) { + backgroundJob().validate(); + } + if (sequencerActions() != null) { + sequencerActions().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("instanceName", this.instanceName); + jsonWriter.writeStringField("jobStatus", this.jobStatus == null ? null : this.jobStatus.toString()); + jsonWriter.writeStringField("jobException", this.jobException); + jsonWriter.writeJsonField("backgroundJob", this.backgroundJob); + jsonWriter.writeArrayField("sequencerActions", this.sequencerActions, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceJobStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceJobStatus if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceJobStatus. + */ + public static SqlServerInstanceJobStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceJobStatus deserializedSqlServerInstanceJobStatus = new SqlServerInstanceJobStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlServerInstanceJobStatus.id = reader.getString(); + } else if ("instanceName".equals(fieldName)) { + deserializedSqlServerInstanceJobStatus.instanceName = reader.getString(); + } else if ("jobStatus".equals(fieldName)) { + deserializedSqlServerInstanceJobStatus.jobStatus = JobStatus.fromString(reader.getString()); + } else if ("jobException".equals(fieldName)) { + deserializedSqlServerInstanceJobStatus.jobException = reader.getString(); + } else if ("backgroundJob".equals(fieldName)) { + deserializedSqlServerInstanceJobStatus.backgroundJob = BackgroundJob.fromJson(reader); + } else if ("sequencerActions".equals(fieldName)) { + List sequencerActions + = reader.readArray(reader1 -> SequencerAction.fromJson(reader1)); + deserializedSqlServerInstanceJobStatus.sequencerActions = sequencerActions; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceJobStatus; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsStatusRequest.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsStatusRequest.java new file mode 100644 index 000000000000..53ff3c2325c5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsStatusRequest.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The request for the status of the jobs running on the SQL Server instance. + */ +@Fluent +public final class SqlServerInstanceJobsStatusRequest implements JsonSerializable { + /* + * The name of the feature to retrieve the job status for. + */ + private String featureName; + + /* + * The type of the job to retrieve the status for. + */ + private String jobType; + + /** + * Creates an instance of SqlServerInstanceJobsStatusRequest class. + */ + public SqlServerInstanceJobsStatusRequest() { + } + + /** + * Get the featureName property: The name of the feature to retrieve the job status for. + * + * @return the featureName value. + */ + public String featureName() { + return this.featureName; + } + + /** + * Set the featureName property: The name of the feature to retrieve the job status for. + * + * @param featureName the featureName value to set. + * @return the SqlServerInstanceJobsStatusRequest object itself. + */ + public SqlServerInstanceJobsStatusRequest withFeatureName(String featureName) { + this.featureName = featureName; + return this; + } + + /** + * Get the jobType property: The type of the job to retrieve the status for. + * + * @return the jobType value. + */ + public String jobType() { + return this.jobType; + } + + /** + * Set the jobType property: The type of the job to retrieve the status for. + * + * @param jobType the jobType value to set. + * @return the SqlServerInstanceJobsStatusRequest object itself. + */ + public SqlServerInstanceJobsStatusRequest withJobType(String jobType) { + this.jobType = jobType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("featureName", this.featureName); + jsonWriter.writeStringField("jobType", this.jobType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceJobsStatusRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceJobsStatusRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceJobsStatusRequest. + */ + public static SqlServerInstanceJobsStatusRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceJobsStatusRequest deserializedSqlServerInstanceJobsStatusRequest + = new SqlServerInstanceJobsStatusRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("featureName".equals(fieldName)) { + deserializedSqlServerInstanceJobsStatusRequest.featureName = reader.getString(); + } else if ("jobType".equals(fieldName)) { + deserializedSqlServerInstanceJobsStatusRequest.jobType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceJobsStatusRequest; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsStatusResponse.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsStatusResponse.java new file mode 100644 index 000000000000..dbfc7a8e5f96 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsStatusResponse.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsStatusResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of SqlServerInstanceJobsStatusResponse. + */ +public interface SqlServerInstanceJobsStatusResponse { + /** + * Gets the jobsStatus property: The list of jobs status running on the SQL Server instance. + * + * @return the jobsStatus value. + */ + List jobsStatus(); + + /** + * Gets the inner com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsStatusResponseInner + * object. + * + * @return the inner object. + */ + SqlServerInstanceJobsStatusResponseInner innerModel(); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceListResult.java index 23c9a9de2c1d..d432729f38cc 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceListResult.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceListResult.java @@ -5,32 +5,38 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** A list of SqlServerInstance. */ +/** + * A list of SqlServerInstance. + */ @Immutable -public final class SqlServerInstanceListResult { +public final class SqlServerInstanceListResult implements JsonSerializable { /* * Array of results. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * Link to retrieve next page of results. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; - /** Creates an instance of SqlServerInstanceListResult class. */ + /** + * Creates an instance of SqlServerInstanceListResult class. + */ public SqlServerInstanceListResult() { } /** * Get the value property: Array of results. - * + * * @return the value value. */ public List value() { @@ -39,7 +45,7 @@ public List value() { /** * Get the nextLink property: Link to retrieve next page of results. - * + * * @return the nextLink value. */ public String nextLink() { @@ -48,7 +54,7 @@ public String nextLink() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -56,4 +62,43 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceListResult. + */ + public static SqlServerInstanceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceListResult deserializedSqlServerInstanceListResult = new SqlServerInstanceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlServerInstanceInner.fromJson(reader1)); + deserializedSqlServerInstanceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSqlServerInstanceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceListResult; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceProperties.java index 3a5942d056e4..4aee0f095083 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceProperties.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceProperties.java @@ -5,122 +5,196 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; -/** Properties of SqlServerInstance. */ +/** + * Properties of SqlServerInstance. + */ @Fluent -public final class SqlServerInstanceProperties { +public final class SqlServerInstanceProperties implements JsonSerializable { /* * SQL Server version. */ - @JsonProperty(value = "version") private SqlVersion version; /* * SQL Server edition. */ - @JsonProperty(value = "edition") private EditionType edition; /* * ARM Resource id of the container resource (Azure Arc for Servers). */ - @JsonProperty(value = "containerResourceId", required = true) private String containerResourceId; /* * The time when the resource was created. */ - @JsonProperty(value = "createTime", access = JsonProperty.Access.WRITE_ONLY) private String createTime; /* * The number of logical processors used by the SQL Server instance. */ - @JsonProperty(value = "vCore") private String vCore; + /* + * The number of total cores of the Operating System Environment (OSE) hosting the SQL Server instance. + */ + private String cores; + /* * The cloud connectivity status. */ - @JsonProperty(value = "status", required = true) private ConnectionStatus status; /* * SQL Server update level. */ - @JsonProperty(value = "patchLevel") private String patchLevel; /* * SQL Server collation. */ - @JsonProperty(value = "collation") private String collation; + /* + * Indicates whether database master key exists in SQL Server. + */ + private Boolean dbMasterKeyExists; + + /* + * Indicates whether always On availability groups is enabled in SQL Server. + */ + private Boolean isHadrEnabled; + + /* + * An array of integers, where each value represents the enabled trace flags in SQL Server. + */ + private List traceFlags; + /* * SQL Server current version. */ - @JsonProperty(value = "currentVersion") private String currentVersion; /* * SQL Server instance name. */ - @JsonProperty(value = "instanceName") private String instanceName; /* * Dynamic TCP ports used by SQL Server. */ - @JsonProperty(value = "tcpDynamicPorts") private String tcpDynamicPorts; /* * Static TCP ports used by SQL Server. */ - @JsonProperty(value = "tcpStaticPorts") private String tcpStaticPorts; /* * SQL Server product ID. */ - @JsonProperty(value = "productId") private String productId; /* * SQL Server license type. */ - @JsonProperty(value = "licenseType") private ArcSqlServerLicenseType licenseType; /* * Timestamp of last Azure Defender status update. */ - @JsonProperty(value = "azureDefenderStatusLastUpdated") private OffsetDateTime azureDefenderStatusLastUpdated; /* * Status of Azure Defender. */ - @JsonProperty(value = "azureDefenderStatus") private DefenderStatus azureDefenderStatus; /* - * The provisioningState property. + * The provisioning state of the Arc-enabled SQL Server resource. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private String provisioningState; - /** Creates an instance of SqlServerInstanceProperties class. */ + /* + * The time when last successful inventory upload was performed. + */ + private OffsetDateTime lastInventoryUploadTime; + + /* + * The time when last successful usage upload was performed. + */ + private OffsetDateTime lastUsageUploadTime; + + /* + * Type of host for Azure Arc SQL Server + */ + private HostType hostType; + + /* + * The role of the SQL Server, based on availability. + */ + private AlwaysOnRole alwaysOnRole; + + /* + * Database mirroring endpoint related properties. + */ + private DbmEndpoint databaseMirroringEndpoint; + + /* + * Failover Cluster Instance properties. + */ + private FailoverCluster failoverCluster; + + /* + * The backup profile for the SQL server. + */ + private BackupPolicy backupPolicy; + + /* + * Upgrade Action for this resource is locked until it expires. The Expiration time indicated by this value. It is + * not locked when it is empty. + */ + private OffsetDateTime upgradeLockedUntil; + + /* + * The monitoring configuration. + */ + private Monitoring monitoring; + + /* + * Migration related configuration. + */ + private Migration migration; + + /* + * Client connection related configuration. + */ + private ClientConnection clientConnection; + + /* + * Indicates if the resource represents a SQL Server engine or a SQL Server component service installed on the host. + */ + private ServiceType serviceType; + + /** + * Creates an instance of SqlServerInstanceProperties class. + */ public SqlServerInstanceProperties() { } /** * Get the version property: SQL Server version. - * + * * @return the version value. */ public SqlVersion version() { @@ -129,7 +203,7 @@ public SqlVersion version() { /** * Set the version property: SQL Server version. - * + * * @param version the version value to set. * @return the SqlServerInstanceProperties object itself. */ @@ -140,7 +214,7 @@ public SqlServerInstanceProperties withVersion(SqlVersion version) { /** * Get the edition property: SQL Server edition. - * + * * @return the edition value. */ public EditionType edition() { @@ -149,7 +223,7 @@ public EditionType edition() { /** * Set the edition property: SQL Server edition. - * + * * @param edition the edition value to set. * @return the SqlServerInstanceProperties object itself. */ @@ -160,27 +234,16 @@ public SqlServerInstanceProperties withEdition(EditionType edition) { /** * Get the containerResourceId property: ARM Resource id of the container resource (Azure Arc for Servers). - * + * * @return the containerResourceId value. */ public String containerResourceId() { return this.containerResourceId; } - /** - * Set the containerResourceId property: ARM Resource id of the container resource (Azure Arc for Servers). - * - * @param containerResourceId the containerResourceId value to set. - * @return the SqlServerInstanceProperties object itself. - */ - public SqlServerInstanceProperties withContainerResourceId(String containerResourceId) { - this.containerResourceId = containerResourceId; - return this; - } - /** * Get the createTime property: The time when the resource was created. - * + * * @return the createTime value. */ public String createTime() { @@ -189,7 +252,7 @@ public String createTime() { /** * Get the vCore property: The number of logical processors used by the SQL Server instance. - * + * * @return the vCore value. */ public String vCore() { @@ -197,59 +260,48 @@ public String vCore() { } /** - * Set the vCore property: The number of logical processors used by the SQL Server instance. - * - * @param vCore the vCore value to set. + * Get the cores property: The number of total cores of the Operating System Environment (OSE) hosting the SQL + * Server instance. + * + * @return the cores value. + */ + public String cores() { + return this.cores; + } + + /** + * Set the cores property: The number of total cores of the Operating System Environment (OSE) hosting the SQL + * Server instance. + * + * @param cores the cores value to set. * @return the SqlServerInstanceProperties object itself. */ - public SqlServerInstanceProperties withVCore(String vCore) { - this.vCore = vCore; + public SqlServerInstanceProperties withCores(String cores) { + this.cores = cores; return this; } /** * Get the status property: The cloud connectivity status. - * + * * @return the status value. */ public ConnectionStatus status() { return this.status; } - /** - * Set the status property: The cloud connectivity status. - * - * @param status the status value to set. - * @return the SqlServerInstanceProperties object itself. - */ - public SqlServerInstanceProperties withStatus(ConnectionStatus status) { - this.status = status; - return this; - } - /** * Get the patchLevel property: SQL Server update level. - * + * * @return the patchLevel value. */ public String patchLevel() { return this.patchLevel; } - /** - * Set the patchLevel property: SQL Server update level. - * - * @param patchLevel the patchLevel value to set. - * @return the SqlServerInstanceProperties object itself. - */ - public SqlServerInstanceProperties withPatchLevel(String patchLevel) { - this.patchLevel = patchLevel; - return this; - } - /** * Get the collation property: SQL Server collation. - * + * * @return the collation value. */ public String collation() { @@ -257,39 +309,45 @@ public String collation() { } /** - * Set the collation property: SQL Server collation. - * - * @param collation the collation value to set. - * @return the SqlServerInstanceProperties object itself. + * Get the dbMasterKeyExists property: Indicates whether database master key exists in SQL Server. + * + * @return the dbMasterKeyExists value. */ - public SqlServerInstanceProperties withCollation(String collation) { - this.collation = collation; - return this; + public Boolean dbMasterKeyExists() { + return this.dbMasterKeyExists; } /** - * Get the currentVersion property: SQL Server current version. - * - * @return the currentVersion value. + * Get the isHadrEnabled property: Indicates whether always On availability groups is enabled in SQL Server. + * + * @return the isHadrEnabled value. */ - public String currentVersion() { - return this.currentVersion; + public Boolean isHadrEnabled() { + return this.isHadrEnabled; } /** - * Set the currentVersion property: SQL Server current version. - * - * @param currentVersion the currentVersion value to set. - * @return the SqlServerInstanceProperties object itself. + * Get the traceFlags property: An array of integers, where each value represents the enabled trace flags in SQL + * Server. + * + * @return the traceFlags value. */ - public SqlServerInstanceProperties withCurrentVersion(String currentVersion) { - this.currentVersion = currentVersion; - return this; + public List traceFlags() { + return this.traceFlags; + } + + /** + * Get the currentVersion property: SQL Server current version. + * + * @return the currentVersion value. + */ + public String currentVersion() { + return this.currentVersion; } /** * Get the instanceName property: SQL Server instance name. - * + * * @return the instanceName value. */ public String instanceName() { @@ -298,7 +356,7 @@ public String instanceName() { /** * Set the instanceName property: SQL Server instance name. - * + * * @param instanceName the instanceName value to set. * @return the SqlServerInstanceProperties object itself. */ @@ -309,7 +367,7 @@ public SqlServerInstanceProperties withInstanceName(String instanceName) { /** * Get the tcpDynamicPorts property: Dynamic TCP ports used by SQL Server. - * + * * @return the tcpDynamicPorts value. */ public String tcpDynamicPorts() { @@ -317,145 +375,416 @@ public String tcpDynamicPorts() { } /** - * Set the tcpDynamicPorts property: Dynamic TCP ports used by SQL Server. - * - * @param tcpDynamicPorts the tcpDynamicPorts value to set. + * Get the tcpStaticPorts property: Static TCP ports used by SQL Server. + * + * @return the tcpStaticPorts value. + */ + public String tcpStaticPorts() { + return this.tcpStaticPorts; + } + + /** + * Get the productId property: SQL Server product ID. + * + * @return the productId value. + */ + public String productId() { + return this.productId; + } + + /** + * Get the licenseType property: SQL Server license type. + * + * @return the licenseType value. + */ + public ArcSqlServerLicenseType licenseType() { + return this.licenseType; + } + + /** + * Get the azureDefenderStatusLastUpdated property: Timestamp of last Azure Defender status update. + * + * @return the azureDefenderStatusLastUpdated value. + */ + public OffsetDateTime azureDefenderStatusLastUpdated() { + return this.azureDefenderStatusLastUpdated; + } + + /** + * Get the azureDefenderStatus property: Status of Azure Defender. + * + * @return the azureDefenderStatus value. + */ + public DefenderStatus azureDefenderStatus() { + return this.azureDefenderStatus; + } + + /** + * Get the provisioningState property: The provisioning state of the Arc-enabled SQL Server resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the lastInventoryUploadTime property: The time when last successful inventory upload was performed. + * + * @return the lastInventoryUploadTime value. + */ + public OffsetDateTime lastInventoryUploadTime() { + return this.lastInventoryUploadTime; + } + + /** + * Get the lastUsageUploadTime property: The time when last successful usage upload was performed. + * + * @return the lastUsageUploadTime value. + */ + public OffsetDateTime lastUsageUploadTime() { + return this.lastUsageUploadTime; + } + + /** + * Get the hostType property: Type of host for Azure Arc SQL Server. + * + * @return the hostType value. + */ + public HostType hostType() { + return this.hostType; + } + + /** + * Set the hostType property: Type of host for Azure Arc SQL Server. + * + * @param hostType the hostType value to set. * @return the SqlServerInstanceProperties object itself. */ - public SqlServerInstanceProperties withTcpDynamicPorts(String tcpDynamicPorts) { - this.tcpDynamicPorts = tcpDynamicPorts; + public SqlServerInstanceProperties withHostType(HostType hostType) { + this.hostType = hostType; return this; } /** - * Get the tcpStaticPorts property: Static TCP ports used by SQL Server. - * - * @return the tcpStaticPorts value. + * Get the alwaysOnRole property: The role of the SQL Server, based on availability. + * + * @return the alwaysOnRole value. */ - public String tcpStaticPorts() { - return this.tcpStaticPorts; + public AlwaysOnRole alwaysOnRole() { + return this.alwaysOnRole; + } + + /** + * Get the databaseMirroringEndpoint property: Database mirroring endpoint related properties. + * + * @return the databaseMirroringEndpoint value. + */ + public DbmEndpoint databaseMirroringEndpoint() { + return this.databaseMirroringEndpoint; } /** - * Set the tcpStaticPorts property: Static TCP ports used by SQL Server. - * - * @param tcpStaticPorts the tcpStaticPorts value to set. + * Set the databaseMirroringEndpoint property: Database mirroring endpoint related properties. + * + * @param databaseMirroringEndpoint the databaseMirroringEndpoint value to set. * @return the SqlServerInstanceProperties object itself. */ - public SqlServerInstanceProperties withTcpStaticPorts(String tcpStaticPorts) { - this.tcpStaticPorts = tcpStaticPorts; + public SqlServerInstanceProperties withDatabaseMirroringEndpoint(DbmEndpoint databaseMirroringEndpoint) { + this.databaseMirroringEndpoint = databaseMirroringEndpoint; return this; } /** - * Get the productId property: SQL Server product ID. - * - * @return the productId value. + * Get the failoverCluster property: Failover Cluster Instance properties. + * + * @return the failoverCluster value. */ - public String productId() { - return this.productId; + public FailoverCluster failoverCluster() { + return this.failoverCluster; } /** - * Set the productId property: SQL Server product ID. - * - * @param productId the productId value to set. + * Set the failoverCluster property: Failover Cluster Instance properties. + * + * @param failoverCluster the failoverCluster value to set. * @return the SqlServerInstanceProperties object itself. */ - public SqlServerInstanceProperties withProductId(String productId) { - this.productId = productId; + public SqlServerInstanceProperties withFailoverCluster(FailoverCluster failoverCluster) { + this.failoverCluster = failoverCluster; return this; } /** - * Get the licenseType property: SQL Server license type. - * - * @return the licenseType value. + * Get the backupPolicy property: The backup profile for the SQL server. + * + * @return the backupPolicy value. */ - public ArcSqlServerLicenseType licenseType() { - return this.licenseType; + public BackupPolicy backupPolicy() { + return this.backupPolicy; } /** - * Set the licenseType property: SQL Server license type. - * - * @param licenseType the licenseType value to set. + * Set the backupPolicy property: The backup profile for the SQL server. + * + * @param backupPolicy the backupPolicy value to set. * @return the SqlServerInstanceProperties object itself. */ - public SqlServerInstanceProperties withLicenseType(ArcSqlServerLicenseType licenseType) { - this.licenseType = licenseType; + public SqlServerInstanceProperties withBackupPolicy(BackupPolicy backupPolicy) { + this.backupPolicy = backupPolicy; return this; } /** - * Get the azureDefenderStatusLastUpdated property: Timestamp of last Azure Defender status update. - * - * @return the azureDefenderStatusLastUpdated value. + * Get the upgradeLockedUntil property: Upgrade Action for this resource is locked until it expires. The Expiration + * time indicated by this value. It is not locked when it is empty. + * + * @return the upgradeLockedUntil value. */ - public OffsetDateTime azureDefenderStatusLastUpdated() { - return this.azureDefenderStatusLastUpdated; + public OffsetDateTime upgradeLockedUntil() { + return this.upgradeLockedUntil; } /** - * Set the azureDefenderStatusLastUpdated property: Timestamp of last Azure Defender status update. - * - * @param azureDefenderStatusLastUpdated the azureDefenderStatusLastUpdated value to set. + * Set the upgradeLockedUntil property: Upgrade Action for this resource is locked until it expires. The Expiration + * time indicated by this value. It is not locked when it is empty. + * + * @param upgradeLockedUntil the upgradeLockedUntil value to set. * @return the SqlServerInstanceProperties object itself. */ - public SqlServerInstanceProperties withAzureDefenderStatusLastUpdated( - OffsetDateTime azureDefenderStatusLastUpdated) { - this.azureDefenderStatusLastUpdated = azureDefenderStatusLastUpdated; + public SqlServerInstanceProperties withUpgradeLockedUntil(OffsetDateTime upgradeLockedUntil) { + this.upgradeLockedUntil = upgradeLockedUntil; return this; } /** - * Get the azureDefenderStatus property: Status of Azure Defender. - * - * @return the azureDefenderStatus value. + * Get the monitoring property: The monitoring configuration. + * + * @return the monitoring value. */ - public DefenderStatus azureDefenderStatus() { - return this.azureDefenderStatus; + public Monitoring monitoring() { + return this.monitoring; } /** - * Set the azureDefenderStatus property: Status of Azure Defender. - * - * @param azureDefenderStatus the azureDefenderStatus value to set. + * Set the monitoring property: The monitoring configuration. + * + * @param monitoring the monitoring value to set. * @return the SqlServerInstanceProperties object itself. */ - public SqlServerInstanceProperties withAzureDefenderStatus(DefenderStatus azureDefenderStatus) { - this.azureDefenderStatus = azureDefenderStatus; + public SqlServerInstanceProperties withMonitoring(Monitoring monitoring) { + this.monitoring = monitoring; return this; } /** - * Get the provisioningState property: The provisioningState property. - * - * @return the provisioningState value. + * Get the migration property: Migration related configuration. + * + * @return the migration value. */ - public String provisioningState() { - return this.provisioningState; + public Migration migration() { + return this.migration; + } + + /** + * Set the migration property: Migration related configuration. + * + * @param migration the migration value to set. + * @return the SqlServerInstanceProperties object itself. + */ + public SqlServerInstanceProperties withMigration(Migration migration) { + this.migration = migration; + return this; + } + + /** + * Get the clientConnection property: Client connection related configuration. + * + * @return the clientConnection value. + */ + public ClientConnection clientConnection() { + return this.clientConnection; + } + + /** + * Set the clientConnection property: Client connection related configuration. + * + * @param clientConnection the clientConnection value to set. + * @return the SqlServerInstanceProperties object itself. + */ + public SqlServerInstanceProperties withClientConnection(ClientConnection clientConnection) { + this.clientConnection = clientConnection; + return this; + } + + /** + * Get the serviceType property: Indicates if the resource represents a SQL Server engine or a SQL Server component + * service installed on the host. + * + * @return the serviceType value. + */ + public ServiceType serviceType() { + return this.serviceType; + } + + /** + * Set the serviceType property: Indicates if the resource represents a SQL Server engine or a SQL Server component + * service installed on the host. + * + * @param serviceType the serviceType value to set. + * @return the SqlServerInstanceProperties object itself. + */ + public SqlServerInstanceProperties withServiceType(ServiceType serviceType) { + this.serviceType = serviceType; + return this; } /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (containerResourceId() == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - "Missing required property containerResourceId in model SqlServerInstanceProperties")); + if (databaseMirroringEndpoint() != null) { + databaseMirroringEndpoint().validate(); } - if (status() == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - "Missing required property status in model SqlServerInstanceProperties")); + if (failoverCluster() != null) { + failoverCluster().validate(); + } + if (backupPolicy() != null) { + backupPolicy().validate(); + } + if (monitoring() != null) { + monitoring().validate(); + } + if (migration() != null) { + migration().validate(); + } + if (clientConnection() != null) { + clientConnection().validate(); } } - private static final ClientLogger LOGGER = new ClientLogger(SqlServerInstanceProperties.class); + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("version", this.version == null ? null : this.version.toString()); + jsonWriter.writeStringField("edition", this.edition == null ? null : this.edition.toString()); + jsonWriter.writeStringField("cores", this.cores); + jsonWriter.writeStringField("instanceName", this.instanceName); + jsonWriter.writeStringField("hostType", this.hostType == null ? null : this.hostType.toString()); + jsonWriter.writeJsonField("databaseMirroringEndpoint", this.databaseMirroringEndpoint); + jsonWriter.writeJsonField("failoverCluster", this.failoverCluster); + jsonWriter.writeJsonField("backupPolicy", this.backupPolicy); + jsonWriter.writeStringField("upgradeLockedUntil", + this.upgradeLockedUntil == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.upgradeLockedUntil)); + jsonWriter.writeJsonField("monitoring", this.monitoring); + jsonWriter.writeJsonField("migration", this.migration); + jsonWriter.writeJsonField("clientConnection", this.clientConnection); + jsonWriter.writeStringField("serviceType", this.serviceType == null ? null : this.serviceType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceProperties. + */ + public static SqlServerInstanceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceProperties deserializedSqlServerInstanceProperties = new SqlServerInstanceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("version".equals(fieldName)) { + deserializedSqlServerInstanceProperties.version = SqlVersion.fromString(reader.getString()); + } else if ("edition".equals(fieldName)) { + deserializedSqlServerInstanceProperties.edition = EditionType.fromString(reader.getString()); + } else if ("containerResourceId".equals(fieldName)) { + deserializedSqlServerInstanceProperties.containerResourceId = reader.getString(); + } else if ("createTime".equals(fieldName)) { + deserializedSqlServerInstanceProperties.createTime = reader.getString(); + } else if ("vCore".equals(fieldName)) { + deserializedSqlServerInstanceProperties.vCore = reader.getString(); + } else if ("cores".equals(fieldName)) { + deserializedSqlServerInstanceProperties.cores = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedSqlServerInstanceProperties.status = ConnectionStatus.fromString(reader.getString()); + } else if ("patchLevel".equals(fieldName)) { + deserializedSqlServerInstanceProperties.patchLevel = reader.getString(); + } else if ("collation".equals(fieldName)) { + deserializedSqlServerInstanceProperties.collation = reader.getString(); + } else if ("dbMasterKeyExists".equals(fieldName)) { + deserializedSqlServerInstanceProperties.dbMasterKeyExists + = reader.getNullable(JsonReader::getBoolean); + } else if ("isHadrEnabled".equals(fieldName)) { + deserializedSqlServerInstanceProperties.isHadrEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("traceFlags".equals(fieldName)) { + List traceFlags = reader.readArray(reader1 -> reader1.getInt()); + deserializedSqlServerInstanceProperties.traceFlags = traceFlags; + } else if ("currentVersion".equals(fieldName)) { + deserializedSqlServerInstanceProperties.currentVersion = reader.getString(); + } else if ("instanceName".equals(fieldName)) { + deserializedSqlServerInstanceProperties.instanceName = reader.getString(); + } else if ("tcpDynamicPorts".equals(fieldName)) { + deserializedSqlServerInstanceProperties.tcpDynamicPorts = reader.getString(); + } else if ("tcpStaticPorts".equals(fieldName)) { + deserializedSqlServerInstanceProperties.tcpStaticPorts = reader.getString(); + } else if ("productId".equals(fieldName)) { + deserializedSqlServerInstanceProperties.productId = reader.getString(); + } else if ("licenseType".equals(fieldName)) { + deserializedSqlServerInstanceProperties.licenseType + = ArcSqlServerLicenseType.fromString(reader.getString()); + } else if ("azureDefenderStatusLastUpdated".equals(fieldName)) { + deserializedSqlServerInstanceProperties.azureDefenderStatusLastUpdated = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("azureDefenderStatus".equals(fieldName)) { + deserializedSqlServerInstanceProperties.azureDefenderStatus + = DefenderStatus.fromString(reader.getString()); + } else if ("provisioningState".equals(fieldName)) { + deserializedSqlServerInstanceProperties.provisioningState = reader.getString(); + } else if ("lastInventoryUploadTime".equals(fieldName)) { + deserializedSqlServerInstanceProperties.lastInventoryUploadTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastUsageUploadTime".equals(fieldName)) { + deserializedSqlServerInstanceProperties.lastUsageUploadTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("hostType".equals(fieldName)) { + deserializedSqlServerInstanceProperties.hostType = HostType.fromString(reader.getString()); + } else if ("alwaysOnRole".equals(fieldName)) { + deserializedSqlServerInstanceProperties.alwaysOnRole = AlwaysOnRole.fromString(reader.getString()); + } else if ("databaseMirroringEndpoint".equals(fieldName)) { + deserializedSqlServerInstanceProperties.databaseMirroringEndpoint = DbmEndpoint.fromJson(reader); + } else if ("failoverCluster".equals(fieldName)) { + deserializedSqlServerInstanceProperties.failoverCluster = FailoverCluster.fromJson(reader); + } else if ("backupPolicy".equals(fieldName)) { + deserializedSqlServerInstanceProperties.backupPolicy = BackupPolicy.fromJson(reader); + } else if ("upgradeLockedUntil".equals(fieldName)) { + deserializedSqlServerInstanceProperties.upgradeLockedUntil = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("monitoring".equals(fieldName)) { + deserializedSqlServerInstanceProperties.monitoring = Monitoring.fromJson(reader); + } else if ("migration".equals(fieldName)) { + deserializedSqlServerInstanceProperties.migration = Migration.fromJson(reader); + } else if ("clientConnection".equals(fieldName)) { + deserializedSqlServerInstanceProperties.clientConnection = ClientConnection.fromJson(reader); + } else if ("serviceType".equals(fieldName)) { + deserializedSqlServerInstanceProperties.serviceType = ServiceType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceProperties; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunMigrationAssessmentResponse.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunMigrationAssessmentResponse.java new file mode 100644 index 000000000000..a75c14fbb4a5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunMigrationAssessmentResponse.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationAssessmentResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of SqlServerInstanceRunMigrationAssessmentResponse. + */ +public interface SqlServerInstanceRunMigrationAssessmentResponse { + /** + * Gets the id property: The unique identifier of the job. + * + * @return the id value. + */ + String id(); + + /** + * Gets the instanceName property: The name of the SQL Server instance. + * + * @return the instanceName value. + */ + String instanceName(); + + /** + * Gets the jobStatus property: The status of the job. + * + * @return the jobStatus value. + */ + JobStatus jobStatus(); + + /** + * Gets the jobException property: The exception message if the job failed. + * + * @return the jobException value. + */ + String jobException(); + + /** + * Gets the backgroundJob property: The background job details. + * + * @return the backgroundJob value. + */ + BackgroundJob backgroundJob(); + + /** + * Gets the sequencerActions property: The list of sequencer actions. + * + * @return the sequencerActions value. + */ + List sequencerActions(); + + /** + * Gets the inner + * com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationAssessmentResponseInner object. + * + * @return the inner object. + */ + SqlServerInstanceRunMigrationAssessmentResponseInner innerModel(); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryColumn.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryColumn.java new file mode 100644 index 000000000000..51e8dc8fc57b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryColumn.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.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The telemetry column for the SQL Server instance. + */ +@Fluent +public final class SqlServerInstanceTelemetryColumn implements JsonSerializable { + /* + * The name of the telemetry column. + */ + private String name; + + /* + * The type of the telemetry column. + */ + private SqlServerInstanceTelemetryColumnType type; + + /** + * Creates an instance of SqlServerInstanceTelemetryColumn class. + */ + public SqlServerInstanceTelemetryColumn() { + } + + /** + * Get the name property: The name of the telemetry column. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the telemetry column. + * + * @param name the name value to set. + * @return the SqlServerInstanceTelemetryColumn object itself. + */ + public SqlServerInstanceTelemetryColumn withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The type of the telemetry column. + * + * @return the type value. + */ + public SqlServerInstanceTelemetryColumnType type() { + return this.type; + } + + /** + * Set the type property: The type of the telemetry column. + * + * @param type the type value to set. + * @return the SqlServerInstanceTelemetryColumn object itself. + */ + public SqlServerInstanceTelemetryColumn withType(SqlServerInstanceTelemetryColumnType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceTelemetryColumn from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceTelemetryColumn if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceTelemetryColumn. + */ + public static SqlServerInstanceTelemetryColumn fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceTelemetryColumn deserializedSqlServerInstanceTelemetryColumn + = new SqlServerInstanceTelemetryColumn(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSqlServerInstanceTelemetryColumn.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlServerInstanceTelemetryColumn.type + = SqlServerInstanceTelemetryColumnType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceTelemetryColumn; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryColumnType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryColumnType.java new file mode 100644 index 000000000000..35a79191f2e6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryColumnType.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of the telemetry column. + */ +public final class SqlServerInstanceTelemetryColumnType + extends ExpandableStringEnum { + /** + * Static value bool for SqlServerInstanceTelemetryColumnType. + */ + public static final SqlServerInstanceTelemetryColumnType BOOL = fromString("bool"); + + /** + * Static value datetime for SqlServerInstanceTelemetryColumnType. + */ + public static final SqlServerInstanceTelemetryColumnType DATETIME = fromString("datetime"); + + /** + * Static value int for SqlServerInstanceTelemetryColumnType. + */ + public static final SqlServerInstanceTelemetryColumnType INT = fromString("int"); + + /** + * Static value long for SqlServerInstanceTelemetryColumnType. + */ + public static final SqlServerInstanceTelemetryColumnType LONG = fromString("long"); + + /** + * Static value double for SqlServerInstanceTelemetryColumnType. + */ + public static final SqlServerInstanceTelemetryColumnType DOUBLE = fromString("double"); + + /** + * Static value string for SqlServerInstanceTelemetryColumnType. + */ + public static final SqlServerInstanceTelemetryColumnType STRING = fromString("string"); + + /** + * Static value guid for SqlServerInstanceTelemetryColumnType. + */ + public static final SqlServerInstanceTelemetryColumnType GUID = fromString("guid"); + + /** + * Static value timespan for SqlServerInstanceTelemetryColumnType. + */ + public static final SqlServerInstanceTelemetryColumnType TIMESPAN = fromString("timespan"); + + /** + * Creates a new instance of SqlServerInstanceTelemetryColumnType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SqlServerInstanceTelemetryColumnType() { + } + + /** + * Creates or finds a SqlServerInstanceTelemetryColumnType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SqlServerInstanceTelemetryColumnType. + */ + public static SqlServerInstanceTelemetryColumnType fromString(String name) { + return fromString(name, SqlServerInstanceTelemetryColumnType.class); + } + + /** + * Gets known SqlServerInstanceTelemetryColumnType values. + * + * @return known SqlServerInstanceTelemetryColumnType values. + */ + public static Collection values() { + return values(SqlServerInstanceTelemetryColumnType.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryRequest.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryRequest.java new file mode 100644 index 000000000000..c2bf641d8976 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryRequest.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * The Arc SQL Server instance telemetry retrieval request. + */ +@Fluent +public final class SqlServerInstanceTelemetryRequest implements JsonSerializable { + /* + * The name of the telemetry dataset to retrieve. + */ + private String datasetName; + + /* + * The start time for the time range to fetch telemetry for. If not specified, the current time minus 1 hour is + * used. + */ + private OffsetDateTime startTime; + + /* + * The end time for the time range to fetch telemetry for. If not specified, the current time is used. + */ + private OffsetDateTime endTime; + + /* + * The time granularity to fetch telemetry for. This is an ISO8601 duration. Examples: PT15M, PT1H, P1D + */ + private Duration interval; + + /* + * The aggregation type to use for the numerical columns in the dataset. + */ + private AggregationType aggregationType; + + /* + * The list of database names to return telemetry for. If not specified, telemetry for all databases will be + * aggregated and returned. + */ + private List databaseNames; + + /** + * Creates an instance of SqlServerInstanceTelemetryRequest class. + */ + public SqlServerInstanceTelemetryRequest() { + } + + /** + * Get the datasetName property: The name of the telemetry dataset to retrieve. + * + * @return the datasetName value. + */ + public String datasetName() { + return this.datasetName; + } + + /** + * Set the datasetName property: The name of the telemetry dataset to retrieve. + * + * @param datasetName the datasetName value to set. + * @return the SqlServerInstanceTelemetryRequest object itself. + */ + public SqlServerInstanceTelemetryRequest withDatasetName(String datasetName) { + this.datasetName = datasetName; + return this; + } + + /** + * Get the startTime property: The start time for the time range to fetch telemetry for. If not specified, the + * current time minus 1 hour is used. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start time for the time range to fetch telemetry for. If not specified, the + * current time minus 1 hour is used. + * + * @param startTime the startTime value to set. + * @return the SqlServerInstanceTelemetryRequest object itself. + */ + public SqlServerInstanceTelemetryRequest withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: The end time for the time range to fetch telemetry for. If not specified, the current + * time is used. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: The end time for the time range to fetch telemetry for. If not specified, the current + * time is used. + * + * @param endTime the endTime value to set. + * @return the SqlServerInstanceTelemetryRequest object itself. + */ + public SqlServerInstanceTelemetryRequest withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the interval property: The time granularity to fetch telemetry for. This is an ISO8601 duration. Examples: + * PT15M, PT1H, P1D. + * + * @return the interval value. + */ + public Duration interval() { + return this.interval; + } + + /** + * Set the interval property: The time granularity to fetch telemetry for. This is an ISO8601 duration. Examples: + * PT15M, PT1H, P1D. + * + * @param interval the interval value to set. + * @return the SqlServerInstanceTelemetryRequest object itself. + */ + public SqlServerInstanceTelemetryRequest withInterval(Duration interval) { + this.interval = interval; + return this; + } + + /** + * Get the aggregationType property: The aggregation type to use for the numerical columns in the dataset. + * + * @return the aggregationType value. + */ + public AggregationType aggregationType() { + return this.aggregationType; + } + + /** + * Set the aggregationType property: The aggregation type to use for the numerical columns in the dataset. + * + * @param aggregationType the aggregationType value to set. + * @return the SqlServerInstanceTelemetryRequest object itself. + */ + public SqlServerInstanceTelemetryRequest withAggregationType(AggregationType aggregationType) { + this.aggregationType = aggregationType; + return this; + } + + /** + * Get the databaseNames property: The list of database names to return telemetry for. If not specified, telemetry + * for all databases will be aggregated and returned. + * + * @return the databaseNames value. + */ + public List databaseNames() { + return this.databaseNames; + } + + /** + * Set the databaseNames property: The list of database names to return telemetry for. If not specified, telemetry + * for all databases will be aggregated and returned. + * + * @param databaseNames the databaseNames value to set. + * @return the SqlServerInstanceTelemetryRequest object itself. + */ + public SqlServerInstanceTelemetryRequest withDatabaseNames(List databaseNames) { + this.databaseNames = databaseNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (datasetName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property datasetName in model SqlServerInstanceTelemetryRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlServerInstanceTelemetryRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("datasetName", this.datasetName); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + jsonWriter.writeStringField("interval", CoreUtils.durationToStringWithDays(this.interval)); + jsonWriter.writeStringField("aggregationType", + this.aggregationType == null ? null : this.aggregationType.toString()); + jsonWriter.writeArrayField("databaseNames", this.databaseNames, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceTelemetryRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceTelemetryRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerInstanceTelemetryRequest. + */ + public static SqlServerInstanceTelemetryRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceTelemetryRequest deserializedSqlServerInstanceTelemetryRequest + = new SqlServerInstanceTelemetryRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("datasetName".equals(fieldName)) { + deserializedSqlServerInstanceTelemetryRequest.datasetName = reader.getString(); + } else if ("startTime".equals(fieldName)) { + deserializedSqlServerInstanceTelemetryRequest.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedSqlServerInstanceTelemetryRequest.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("interval".equals(fieldName)) { + deserializedSqlServerInstanceTelemetryRequest.interval + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("aggregationType".equals(fieldName)) { + deserializedSqlServerInstanceTelemetryRequest.aggregationType + = AggregationType.fromString(reader.getString()); + } else if ("databaseNames".equals(fieldName)) { + List databaseNames = reader.readArray(reader1 -> reader1.getString()); + deserializedSqlServerInstanceTelemetryRequest.databaseNames = databaseNames; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceTelemetryRequest; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryResponse.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryResponse.java new file mode 100644 index 000000000000..24aba0bcefdf --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryResponse.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A section of the telemetry response for the SQL Server instance. + */ +@Fluent +public final class SqlServerInstanceTelemetryResponse implements JsonSerializable { + /* + * The columns of the result telemetry table for the SQL Server instance. + */ + private List columns; + + /* + * A list of rows from the result telemetry table for the SQL Server instance. + */ + private List> rows; + + /* + * The link to the next section of rows of the telemetry response for the SQL Server instance. Null if no more + * sections are available. + */ + private String nextLink; + + /** + * Creates an instance of SqlServerInstanceTelemetryResponse class. + */ + public SqlServerInstanceTelemetryResponse() { + } + + /** + * Get the columns property: The columns of the result telemetry table for the SQL Server instance. + * + * @return the columns value. + */ + public List columns() { + return this.columns; + } + + /** + * Set the columns property: The columns of the result telemetry table for the SQL Server instance. + * + * @param columns the columns value to set. + * @return the SqlServerInstanceTelemetryResponse object itself. + */ + public SqlServerInstanceTelemetryResponse withColumns(List columns) { + this.columns = columns; + return this; + } + + /** + * Get the rows property: A list of rows from the result telemetry table for the SQL Server instance. + * + * @return the rows value. + */ + public List> rows() { + return this.rows; + } + + /** + * Set the rows property: A list of rows from the result telemetry table for the SQL Server instance. + * + * @param rows the rows value to set. + * @return the SqlServerInstanceTelemetryResponse object itself. + */ + public SqlServerInstanceTelemetryResponse withRows(List> rows) { + this.rows = rows; + return this; + } + + /** + * Get the nextLink property: The link to the next section of rows of the telemetry response for the SQL Server + * instance. Null if no more sections are available. + * + * @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 (columns() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property columns in model SqlServerInstanceTelemetryResponse")); + } else { + columns().forEach(e -> e.validate()); + } + if (rows() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property rows in model SqlServerInstanceTelemetryResponse")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlServerInstanceTelemetryResponse.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("columns", this.columns, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("rows", this.rows, + (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1))); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceTelemetryResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceTelemetryResponse if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerInstanceTelemetryResponse. + */ + public static SqlServerInstanceTelemetryResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceTelemetryResponse deserializedSqlServerInstanceTelemetryResponse + = new SqlServerInstanceTelemetryResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("columns".equals(fieldName)) { + List columns + = reader.readArray(reader1 -> SqlServerInstanceTelemetryColumn.fromJson(reader1)); + deserializedSqlServerInstanceTelemetryResponse.columns = columns; + } else if ("rows".equals(fieldName)) { + List> rows + = reader.readArray(reader1 -> reader1.readArray(reader2 -> reader2.getString())); + deserializedSqlServerInstanceTelemetryResponse.rows = rows; + } else if ("nextLink".equals(fieldName)) { + deserializedSqlServerInstanceTelemetryResponse.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceTelemetryResponse; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceUpdate.java index 606d0a7e2de3..8dd2add1161e 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceUpdate.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceUpdate.java @@ -5,27 +5,37 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; -/** An update to a SQL Server Instance. */ +/** + * An update to a SQL Server Instance. + */ @Fluent -public final class SqlServerInstanceUpdate { +public final class SqlServerInstanceUpdate implements JsonSerializable { /* * Resource tags. */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; - /** Creates an instance of SqlServerInstanceUpdate class. */ + /* + * null + */ + private SqlServerInstanceUpdateProperties properties; + + /** + * Creates an instance of SqlServerInstanceUpdate class. + */ public SqlServerInstanceUpdate() { } /** * Get the tags property: Resource tags. - * + * * @return the tags value. */ public Map tags() { @@ -34,7 +44,7 @@ public Map tags() { /** * Set the tags property: Resource tags. - * + * * @param tags the tags value to set. * @return the SqlServerInstanceUpdate object itself. */ @@ -43,11 +53,74 @@ public SqlServerInstanceUpdate withTags(Map tags) { return this; } + /** + * Get the properties property: null. + * + * @return the properties value. + */ + public SqlServerInstanceUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: null. + * + * @param properties the properties value to set. + * @return the SqlServerInstanceUpdate object itself. + */ + public SqlServerInstanceUpdate withProperties(SqlServerInstanceUpdateProperties properties) { + this.properties = properties; + return this; + } + /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceUpdate if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceUpdate. + */ + public static SqlServerInstanceUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceUpdate deserializedSqlServerInstanceUpdate = new SqlServerInstanceUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerInstanceUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedSqlServerInstanceUpdate.properties = SqlServerInstanceUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceUpdate; + }); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceUpdateProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceUpdateProperties.java new file mode 100644 index 000000000000..522107c75dd8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceUpdateProperties.java @@ -0,0 +1,764 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * Properties of update SqlServerInstance. + */ +@Fluent +public final class SqlServerInstanceUpdateProperties implements JsonSerializable { + /* + * SQL Server version. + */ + private SqlVersion version; + + /* + * SQL Server edition. + */ + private EditionType edition; + + /* + * ARM Resource id of the container resource (Azure Arc for Servers). + */ + private String containerResourceId; + + /* + * The time when the resource was created. + */ + private String createTime; + + /* + * The number of logical processors used by the SQL Server instance. + */ + private String vCore; + + /* + * The number of total cores of the Operating System Environment (OSE) hosting the SQL Server instance. + */ + private String cores; + + /* + * The cloud connectivity status. + */ + private ConnectionStatus status; + + /* + * SQL Server update level. + */ + private String patchLevel; + + /* + * SQL Server collation. + */ + private String collation; + + /* + * Indicates whether database master key exists in SQL Server. + */ + private Boolean dbMasterKeyExists; + + /* + * Indicates whether always On availability groups is enabled in SQL Server. + */ + private Boolean isHadrEnabled; + + /* + * An array of integers, where each value represents the enabled trace flags in SQL Server. + */ + private List traceFlags; + + /* + * SQL Server current version. + */ + private String currentVersion; + + /* + * SQL Server instance name. + */ + private String instanceName; + + /* + * Dynamic TCP ports used by SQL Server. + */ + private String tcpDynamicPorts; + + /* + * Static TCP ports used by SQL Server. + */ + private String tcpStaticPorts; + + /* + * SQL Server product ID. + */ + private String productId; + + /* + * SQL Server license type. + */ + private ArcSqlServerLicenseType licenseType; + + /* + * Timestamp of last Azure Defender status update. + */ + private OffsetDateTime azureDefenderStatusLastUpdated; + + /* + * Status of Azure Defender. + */ + private DefenderStatus azureDefenderStatus; + + /* + * The provisioning state of the Arc-enabled SQL Server resource. + */ + private String provisioningState; + + /* + * The time when last successful inventory upload was performed. + */ + private OffsetDateTime lastInventoryUploadTime; + + /* + * The time when last successful usage upload was performed. + */ + private OffsetDateTime lastUsageUploadTime; + + /* + * Type of host for Azure Arc SQL Server + */ + private HostType hostType; + + /* + * The role of the SQL Server, based on availability. + */ + private AlwaysOnRole alwaysOnRole; + + /* + * Failover Cluster Instance properties. + */ + private FailoverCluster failoverCluster; + + /* + * The backup profile for the SQL server. + */ + private BackupPolicy backupPolicy; + + /* + * Upgrade Action for this resource is locked until it expires. The Expiration time indicated by this value. It is + * not locked when it is empty. + */ + private OffsetDateTime upgradeLockedUntil; + + /* + * The monitoring configuration. + */ + private Monitoring monitoring; + + /* + * Migration related configuration. + */ + private Migration migration; + + /* + * Client connection related configuration. + */ + private ClientConnection clientConnection; + + /* + * Indicates if the resource represents a SQL Server engine or a SQL Server component service installed on the host. + */ + private ServiceType serviceType; + + /** + * Creates an instance of SqlServerInstanceUpdateProperties class. + */ + public SqlServerInstanceUpdateProperties() { + } + + /** + * Get the version property: SQL Server version. + * + * @return the version value. + */ + public SqlVersion version() { + return this.version; + } + + /** + * Set the version property: SQL Server version. + * + * @param version the version value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withVersion(SqlVersion version) { + this.version = version; + return this; + } + + /** + * Get the edition property: SQL Server edition. + * + * @return the edition value. + */ + public EditionType edition() { + return this.edition; + } + + /** + * Set the edition property: SQL Server edition. + * + * @param edition the edition value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withEdition(EditionType edition) { + this.edition = edition; + return this; + } + + /** + * Get the containerResourceId property: ARM Resource id of the container resource (Azure Arc for Servers). + * + * @return the containerResourceId value. + */ + public String containerResourceId() { + return this.containerResourceId; + } + + /** + * Get the createTime property: The time when the resource was created. + * + * @return the createTime value. + */ + public String createTime() { + return this.createTime; + } + + /** + * Get the vCore property: The number of logical processors used by the SQL Server instance. + * + * @return the vCore value. + */ + public String vCore() { + return this.vCore; + } + + /** + * Get the cores property: The number of total cores of the Operating System Environment (OSE) hosting the SQL + * Server instance. + * + * @return the cores value. + */ + public String cores() { + return this.cores; + } + + /** + * Set the cores property: The number of total cores of the Operating System Environment (OSE) hosting the SQL + * Server instance. + * + * @param cores the cores value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withCores(String cores) { + this.cores = cores; + return this; + } + + /** + * Get the status property: The cloud connectivity status. + * + * @return the status value. + */ + public ConnectionStatus status() { + return this.status; + } + + /** + * Get the patchLevel property: SQL Server update level. + * + * @return the patchLevel value. + */ + public String patchLevel() { + return this.patchLevel; + } + + /** + * Get the collation property: SQL Server collation. + * + * @return the collation value. + */ + public String collation() { + return this.collation; + } + + /** + * Get the dbMasterKeyExists property: Indicates whether database master key exists in SQL Server. + * + * @return the dbMasterKeyExists value. + */ + public Boolean dbMasterKeyExists() { + return this.dbMasterKeyExists; + } + + /** + * Get the isHadrEnabled property: Indicates whether always On availability groups is enabled in SQL Server. + * + * @return the isHadrEnabled value. + */ + public Boolean isHadrEnabled() { + return this.isHadrEnabled; + } + + /** + * Get the traceFlags property: An array of integers, where each value represents the enabled trace flags in SQL + * Server. + * + * @return the traceFlags value. + */ + public List traceFlags() { + return this.traceFlags; + } + + /** + * Get the currentVersion property: SQL Server current version. + * + * @return the currentVersion value. + */ + public String currentVersion() { + return this.currentVersion; + } + + /** + * Get the instanceName property: SQL Server instance name. + * + * @return the instanceName value. + */ + public String instanceName() { + return this.instanceName; + } + + /** + * Set the instanceName property: SQL Server instance name. + * + * @param instanceName the instanceName value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withInstanceName(String instanceName) { + this.instanceName = instanceName; + return this; + } + + /** + * Get the tcpDynamicPorts property: Dynamic TCP ports used by SQL Server. + * + * @return the tcpDynamicPorts value. + */ + public String tcpDynamicPorts() { + return this.tcpDynamicPorts; + } + + /** + * Get the tcpStaticPorts property: Static TCP ports used by SQL Server. + * + * @return the tcpStaticPorts value. + */ + public String tcpStaticPorts() { + return this.tcpStaticPorts; + } + + /** + * Get the productId property: SQL Server product ID. + * + * @return the productId value. + */ + public String productId() { + return this.productId; + } + + /** + * Get the licenseType property: SQL Server license type. + * + * @return the licenseType value. + */ + public ArcSqlServerLicenseType licenseType() { + return this.licenseType; + } + + /** + * Get the azureDefenderStatusLastUpdated property: Timestamp of last Azure Defender status update. + * + * @return the azureDefenderStatusLastUpdated value. + */ + public OffsetDateTime azureDefenderStatusLastUpdated() { + return this.azureDefenderStatusLastUpdated; + } + + /** + * Get the azureDefenderStatus property: Status of Azure Defender. + * + * @return the azureDefenderStatus value. + */ + public DefenderStatus azureDefenderStatus() { + return this.azureDefenderStatus; + } + + /** + * Get the provisioningState property: The provisioning state of the Arc-enabled SQL Server resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the lastInventoryUploadTime property: The time when last successful inventory upload was performed. + * + * @return the lastInventoryUploadTime value. + */ + public OffsetDateTime lastInventoryUploadTime() { + return this.lastInventoryUploadTime; + } + + /** + * Get the lastUsageUploadTime property: The time when last successful usage upload was performed. + * + * @return the lastUsageUploadTime value. + */ + public OffsetDateTime lastUsageUploadTime() { + return this.lastUsageUploadTime; + } + + /** + * Get the hostType property: Type of host for Azure Arc SQL Server. + * + * @return the hostType value. + */ + public HostType hostType() { + return this.hostType; + } + + /** + * Set the hostType property: Type of host for Azure Arc SQL Server. + * + * @param hostType the hostType value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withHostType(HostType hostType) { + this.hostType = hostType; + return this; + } + + /** + * Get the alwaysOnRole property: The role of the SQL Server, based on availability. + * + * @return the alwaysOnRole value. + */ + public AlwaysOnRole alwaysOnRole() { + return this.alwaysOnRole; + } + + /** + * Get the failoverCluster property: Failover Cluster Instance properties. + * + * @return the failoverCluster value. + */ + public FailoverCluster failoverCluster() { + return this.failoverCluster; + } + + /** + * Set the failoverCluster property: Failover Cluster Instance properties. + * + * @param failoverCluster the failoverCluster value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withFailoverCluster(FailoverCluster failoverCluster) { + this.failoverCluster = failoverCluster; + return this; + } + + /** + * Get the backupPolicy property: The backup profile for the SQL server. + * + * @return the backupPolicy value. + */ + public BackupPolicy backupPolicy() { + return this.backupPolicy; + } + + /** + * Set the backupPolicy property: The backup profile for the SQL server. + * + * @param backupPolicy the backupPolicy value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withBackupPolicy(BackupPolicy backupPolicy) { + this.backupPolicy = backupPolicy; + return this; + } + + /** + * Get the upgradeLockedUntil property: Upgrade Action for this resource is locked until it expires. The Expiration + * time indicated by this value. It is not locked when it is empty. + * + * @return the upgradeLockedUntil value. + */ + public OffsetDateTime upgradeLockedUntil() { + return this.upgradeLockedUntil; + } + + /** + * Set the upgradeLockedUntil property: Upgrade Action for this resource is locked until it expires. The Expiration + * time indicated by this value. It is not locked when it is empty. + * + * @param upgradeLockedUntil the upgradeLockedUntil value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withUpgradeLockedUntil(OffsetDateTime upgradeLockedUntil) { + this.upgradeLockedUntil = upgradeLockedUntil; + return this; + } + + /** + * Get the monitoring property: The monitoring configuration. + * + * @return the monitoring value. + */ + public Monitoring monitoring() { + return this.monitoring; + } + + /** + * Set the monitoring property: The monitoring configuration. + * + * @param monitoring the monitoring value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withMonitoring(Monitoring monitoring) { + this.monitoring = monitoring; + return this; + } + + /** + * Get the migration property: Migration related configuration. + * + * @return the migration value. + */ + public Migration migration() { + return this.migration; + } + + /** + * Set the migration property: Migration related configuration. + * + * @param migration the migration value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withMigration(Migration migration) { + this.migration = migration; + return this; + } + + /** + * Get the clientConnection property: Client connection related configuration. + * + * @return the clientConnection value. + */ + public ClientConnection clientConnection() { + return this.clientConnection; + } + + /** + * Set the clientConnection property: Client connection related configuration. + * + * @param clientConnection the clientConnection value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withClientConnection(ClientConnection clientConnection) { + this.clientConnection = clientConnection; + return this; + } + + /** + * Get the serviceType property: Indicates if the resource represents a SQL Server engine or a SQL Server component + * service installed on the host. + * + * @return the serviceType value. + */ + public ServiceType serviceType() { + return this.serviceType; + } + + /** + * Set the serviceType property: Indicates if the resource represents a SQL Server engine or a SQL Server component + * service installed on the host. + * + * @param serviceType the serviceType value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withServiceType(ServiceType serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (failoverCluster() != null) { + failoverCluster().validate(); + } + if (backupPolicy() != null) { + backupPolicy().validate(); + } + if (monitoring() != null) { + monitoring().validate(); + } + if (migration() != null) { + migration().validate(); + } + if (clientConnection() != null) { + clientConnection().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("version", this.version == null ? null : this.version.toString()); + jsonWriter.writeStringField("edition", this.edition == null ? null : this.edition.toString()); + jsonWriter.writeStringField("cores", this.cores); + jsonWriter.writeStringField("instanceName", this.instanceName); + jsonWriter.writeStringField("hostType", this.hostType == null ? null : this.hostType.toString()); + jsonWriter.writeJsonField("failoverCluster", this.failoverCluster); + jsonWriter.writeJsonField("backupPolicy", this.backupPolicy); + jsonWriter.writeStringField("upgradeLockedUntil", + this.upgradeLockedUntil == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.upgradeLockedUntil)); + jsonWriter.writeJsonField("monitoring", this.monitoring); + jsonWriter.writeJsonField("migration", this.migration); + jsonWriter.writeJsonField("clientConnection", this.clientConnection); + jsonWriter.writeStringField("serviceType", this.serviceType == null ? null : this.serviceType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceUpdateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceUpdateProperties. + */ + public static SqlServerInstanceUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceUpdateProperties deserializedSqlServerInstanceUpdateProperties + = new SqlServerInstanceUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("version".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.version = SqlVersion.fromString(reader.getString()); + } else if ("edition".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.edition = EditionType.fromString(reader.getString()); + } else if ("containerResourceId".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.containerResourceId = reader.getString(); + } else if ("createTime".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.createTime = reader.getString(); + } else if ("vCore".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.vCore = reader.getString(); + } else if ("cores".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.cores = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.status + = ConnectionStatus.fromString(reader.getString()); + } else if ("patchLevel".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.patchLevel = reader.getString(); + } else if ("collation".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.collation = reader.getString(); + } else if ("dbMasterKeyExists".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.dbMasterKeyExists + = reader.getNullable(JsonReader::getBoolean); + } else if ("isHadrEnabled".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.isHadrEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("traceFlags".equals(fieldName)) { + List traceFlags = reader.readArray(reader1 -> reader1.getInt()); + deserializedSqlServerInstanceUpdateProperties.traceFlags = traceFlags; + } else if ("currentVersion".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.currentVersion = reader.getString(); + } else if ("instanceName".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.instanceName = reader.getString(); + } else if ("tcpDynamicPorts".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.tcpDynamicPorts = reader.getString(); + } else if ("tcpStaticPorts".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.tcpStaticPorts = reader.getString(); + } else if ("productId".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.productId = reader.getString(); + } else if ("licenseType".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.licenseType + = ArcSqlServerLicenseType.fromString(reader.getString()); + } else if ("azureDefenderStatusLastUpdated".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.azureDefenderStatusLastUpdated = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("azureDefenderStatus".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.azureDefenderStatus + = DefenderStatus.fromString(reader.getString()); + } else if ("provisioningState".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.provisioningState = reader.getString(); + } else if ("lastInventoryUploadTime".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.lastInventoryUploadTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastUsageUploadTime".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.lastUsageUploadTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("hostType".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.hostType = HostType.fromString(reader.getString()); + } else if ("alwaysOnRole".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.alwaysOnRole + = AlwaysOnRole.fromString(reader.getString()); + } else if ("failoverCluster".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.failoverCluster = FailoverCluster.fromJson(reader); + } else if ("backupPolicy".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.backupPolicy = BackupPolicy.fromJson(reader); + } else if ("upgradeLockedUntil".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.upgradeLockedUntil = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("monitoring".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.monitoring = Monitoring.fromJson(reader); + } else if ("migration".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.migration = Migration.fromJson(reader); + } else if ("clientConnection".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.clientConnection = ClientConnection.fromJson(reader); + } else if ("serviceType".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.serviceType + = ServiceType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceUpdateProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstances.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstances.java index 7e56b7be2ceb..26b49512e9dc 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstances.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstances.java @@ -7,12 +7,15 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; +import java.util.List; -/** Resource collection API of SqlServerInstances. */ +/** + * Resource collection API of SqlServerInstances. + */ public interface SqlServerInstances { /** * List sqlServerInstance resources in the 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 SqlServerInstance as paginated response with {@link PagedIterable}. @@ -21,7 +24,7 @@ public interface SqlServerInstances { /** * List sqlServerInstance resources in the 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. @@ -32,9 +35,9 @@ public interface SqlServerInstances { /** * List sqlServerInstance resources in the resource group - * - *

Gets all sqlServerInstances in a resource group. - * + * + * Gets all sqlServerInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -45,9 +48,9 @@ public interface SqlServerInstances { /** * List sqlServerInstance resources in the resource group - * - *

Gets all sqlServerInstances in a resource group. - * + * + * Gets all sqlServerInstances in a resource group. + * * @param resourceGroupName The name of the Azure resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -59,7 +62,7 @@ public interface SqlServerInstances { /** * Retrieves a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. @@ -68,12 +71,12 @@ public interface SqlServerInstances { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a SqlServerInstance along with {@link Response}. */ - Response getByResourceGroupWithResponse( - String resourceGroupName, String sqlServerInstanceName, Context context); + Response getByResourceGroupWithResponse(String resourceGroupName, String sqlServerInstanceName, + Context context); /** * Retrieves a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -85,9 +88,9 @@ Response getByResourceGroupWithResponse( /** * Deletes a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -96,9 +99,9 @@ Response getByResourceGroupWithResponse( /** * Deletes a SQL Server Instance resource. - * + * * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -106,9 +109,147 @@ Response getByResourceGroupWithResponse( */ void delete(String resourceGroupName, String sqlServerInstanceName, Context context); + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a section of the telemetry response for the SQL Server instance as paginated response with + * {@link PagedIterable}. + */ + PagedIterable> getTelemetry(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest); + + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a section of the telemetry response for the SQL Server instance as paginated response with + * {@link PagedIterable}. + */ + PagedIterable> getTelemetry(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, Context context); + + /** + * Runs migration assessment for SQL Server instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance along with {@link Response}. + */ + Response + runMigrationAssessmentWithResponse(String resourceGroupName, String sqlServerInstanceName, Context context); + + /** + * Runs migration assessment for SQL Server instance. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance. + */ + SqlServerInstanceRunMigrationAssessmentResponse runMigrationAssessment(String resourceGroupName, + String sqlServerInstanceName); + + /** + * Gets jobs status details for sql arc resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsStatusRequest Contains the parameters to get SQL Server instance agent jobs status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource along with {@link Response}. + */ + Response getJobsStatusWithResponse(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest, + Context context); + + /** + * Gets jobs status details for sql arc resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource. + */ + SqlServerInstanceJobsStatusResponse getJobsStatus(String resourceGroupName, String sqlServerInstanceName); + + /** + * Request Upgrade Permission before upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + Response preUpgradeWithResponse(String resourceGroupName, String sqlServerInstanceName, + Context context); + + /** + * Request Upgrade Permission before upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + SqlServerInstance preUpgrade(String resourceGroupName, String sqlServerInstanceName); + + /** + * Clean up after upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + Response postUpgradeWithResponse(String resourceGroupName, String sqlServerInstanceName, + Context context); + + /** + * Clean up after upgrading. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + SqlServerInstance postUpgrade(String resourceGroupName, String sqlServerInstanceName); + /** * Retrieves a SQL Server Instance resource. - * + * * @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. @@ -119,7 +260,7 @@ Response getByResourceGroupWithResponse( /** * Retrieves a SQL Server Instance resource. - * + * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -131,7 +272,7 @@ Response getByResourceGroupWithResponse( /** * Deletes a SQL Server Instance resource. - * + * * @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. @@ -141,7 +282,7 @@ Response getByResourceGroupWithResponse( /** * Deletes a SQL Server Instance resource. - * + * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -152,7 +293,7 @@ Response getByResourceGroupWithResponse( /** * Begins definition for a new SqlServerInstance resource. - * + * * @param name resource name. * @return the first stage of the new SqlServerInstance definition. */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicense.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicense.java new file mode 100644 index 000000000000..79dbd904fa8e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicense.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerLicenseInner; +import java.util.Map; + +/** + * An immutable client-side representation of SqlServerLicense. + */ +public interface SqlServerLicense { + /** + * 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 properties property: SQL Server license properties. + * + * @return the properties value. + */ + SqlServerLicenseProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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.azurearcdata.fluent.models.SqlServerLicenseInner object. + * + * @return the inner object. + */ + SqlServerLicenseInner innerModel(); + + /** + * The entirety of the SqlServerLicense definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * The SqlServerLicense definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SqlServerLicense definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the SqlServerLicense 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 SqlServerLicense definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the Azure resource group. + * @return the next definition stage. + */ + WithProperties withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the SqlServerLicense definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: SQL Server license properties. + * + * @param properties SQL Server license properties. + * @return the next definition stage. + */ + WithCreate withProperties(SqlServerLicenseProperties properties); + } + + /** + * The stage of the SqlServerLicense 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlServerLicense create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlServerLicense create(Context context); + } + + /** + * The stage of the SqlServerLicense 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); + } + } + + /** + * Begins update for the SqlServerLicense resource. + * + * @return the stage of resource update. + */ + SqlServerLicense.Update update(); + + /** + * The template for SqlServerLicense update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlServerLicense apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlServerLicense apply(Context context); + } + + /** + * The SqlServerLicense update stages. + */ + interface UpdateStages { + /** + * The stage of the SqlServerLicense update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the SqlServerLicense update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: null. + * + * @param properties null. + * @return the next definition stage. + */ + Update withProperties(SqlServerLicenseUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlServerLicense refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlServerLicense refresh(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseListResult.java new file mode 100644 index 000000000000..08ebe33311da --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseListResult.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerLicenseInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of SQL Server licenses. + */ +@Immutable +public final class SqlServerLicenseListResult implements JsonSerializable { + /* + * Array of results. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of SqlServerLicenseListResult class. + */ + public SqlServerLicenseListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerLicenseListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerLicenseListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerLicenseListResult. + */ + public static SqlServerLicenseListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerLicenseListResult deserializedSqlServerLicenseListResult = new SqlServerLicenseListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlServerLicenseInner.fromJson(reader1)); + deserializedSqlServerLicenseListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSqlServerLicenseListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerLicenseListResult; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseProperties.java new file mode 100644 index 000000000000..3823b5ca10ad --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseProperties.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Properties of SQL Server License. + */ +@Fluent +public final class SqlServerLicenseProperties implements JsonSerializable { + /* + * SQL Server license type. + */ + private BillingPlan billingPlan; + + /* + * The number of total cores of the license covers. + */ + private int physicalCores; + + /* + * This property represents the choice between SQL Server Core and ESU licenses. + */ + private LicenseCategory licenseCategory; + + /* + * The activation state of the license. + */ + private ActivationState activationState; + + /* + * The Azure scope to which the license will apply. + */ + private ScopeType scopeType; + + /* + * The timestamp of the most recent activation of the SqlServerLicense. + */ + private OffsetDateTime lastActivatedAt; + + /* + * The timestamp of the most recent deactivation of the SqlServerLicense. + */ + private OffsetDateTime lastDeactivatedAt; + + /* + * The tenantId the SQL Server license resource subscription resides in. + */ + private String tenantId; + + /** + * Creates an instance of SqlServerLicenseProperties class. + */ + public SqlServerLicenseProperties() { + } + + /** + * Get the billingPlan property: SQL Server license type. + * + * @return the billingPlan value. + */ + public BillingPlan billingPlan() { + return this.billingPlan; + } + + /** + * Set the billingPlan property: SQL Server license type. + * + * @param billingPlan the billingPlan value to set. + * @return the SqlServerLicenseProperties object itself. + */ + public SqlServerLicenseProperties withBillingPlan(BillingPlan billingPlan) { + this.billingPlan = billingPlan; + return this; + } + + /** + * Get the physicalCores property: The number of total cores of the license covers. + * + * @return the physicalCores value. + */ + public int physicalCores() { + return this.physicalCores; + } + + /** + * Set the physicalCores property: The number of total cores of the license covers. + * + * @param physicalCores the physicalCores value to set. + * @return the SqlServerLicenseProperties object itself. + */ + public SqlServerLicenseProperties withPhysicalCores(int physicalCores) { + this.physicalCores = physicalCores; + return this; + } + + /** + * Get the licenseCategory property: This property represents the choice between SQL Server Core and ESU licenses. + * + * @return the licenseCategory value. + */ + public LicenseCategory licenseCategory() { + return this.licenseCategory; + } + + /** + * Set the licenseCategory property: This property represents the choice between SQL Server Core and ESU licenses. + * + * @param licenseCategory the licenseCategory value to set. + * @return the SqlServerLicenseProperties object itself. + */ + public SqlServerLicenseProperties withLicenseCategory(LicenseCategory licenseCategory) { + this.licenseCategory = licenseCategory; + return this; + } + + /** + * Get the activationState property: The activation state of the license. + * + * @return the activationState value. + */ + public ActivationState activationState() { + return this.activationState; + } + + /** + * Set the activationState property: The activation state of the license. + * + * @param activationState the activationState value to set. + * @return the SqlServerLicenseProperties object itself. + */ + public SqlServerLicenseProperties withActivationState(ActivationState activationState) { + this.activationState = activationState; + return this; + } + + /** + * Get the scopeType property: The Azure scope to which the license will apply. + * + * @return the scopeType value. + */ + public ScopeType scopeType() { + return this.scopeType; + } + + /** + * Set the scopeType property: The Azure scope to which the license will apply. + * + * @param scopeType the scopeType value to set. + * @return the SqlServerLicenseProperties object itself. + */ + public SqlServerLicenseProperties withScopeType(ScopeType scopeType) { + this.scopeType = scopeType; + return this; + } + + /** + * Get the lastActivatedAt property: The timestamp of the most recent activation of the SqlServerLicense. + * + * @return the lastActivatedAt value. + */ + public OffsetDateTime lastActivatedAt() { + return this.lastActivatedAt; + } + + /** + * Get the lastDeactivatedAt property: The timestamp of the most recent deactivation of the SqlServerLicense. + * + * @return the lastDeactivatedAt value. + */ + public OffsetDateTime lastDeactivatedAt() { + return this.lastDeactivatedAt; + } + + /** + * Get the tenantId property: The tenantId the SQL Server license resource subscription resides in. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (billingPlan() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property billingPlan in model SqlServerLicenseProperties")); + } + if (licenseCategory() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property licenseCategory in model SqlServerLicenseProperties")); + } + if (activationState() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property activationState in model SqlServerLicenseProperties")); + } + if (scopeType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property scopeType in model SqlServerLicenseProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlServerLicenseProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("billingPlan", this.billingPlan == null ? null : this.billingPlan.toString()); + jsonWriter.writeIntField("physicalCores", this.physicalCores); + jsonWriter.writeStringField("licenseCategory", + this.licenseCategory == null ? null : this.licenseCategory.toString()); + jsonWriter.writeStringField("activationState", + this.activationState == null ? null : this.activationState.toString()); + jsonWriter.writeStringField("scopeType", this.scopeType == null ? null : this.scopeType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerLicenseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerLicenseProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerLicenseProperties. + */ + public static SqlServerLicenseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerLicenseProperties deserializedSqlServerLicenseProperties = new SqlServerLicenseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("billingPlan".equals(fieldName)) { + deserializedSqlServerLicenseProperties.billingPlan = BillingPlan.fromString(reader.getString()); + } else if ("physicalCores".equals(fieldName)) { + deserializedSqlServerLicenseProperties.physicalCores = reader.getInt(); + } else if ("licenseCategory".equals(fieldName)) { + deserializedSqlServerLicenseProperties.licenseCategory + = LicenseCategory.fromString(reader.getString()); + } else if ("activationState".equals(fieldName)) { + deserializedSqlServerLicenseProperties.activationState + = ActivationState.fromString(reader.getString()); + } else if ("scopeType".equals(fieldName)) { + deserializedSqlServerLicenseProperties.scopeType = ScopeType.fromString(reader.getString()); + } else if ("lastActivatedAt".equals(fieldName)) { + deserializedSqlServerLicenseProperties.lastActivatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastDeactivatedAt".equals(fieldName)) { + deserializedSqlServerLicenseProperties.lastDeactivatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedSqlServerLicenseProperties.tenantId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerLicenseProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseUpdate.java new file mode 100644 index 000000000000..ab4316e93a95 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseUpdate.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * An update to a SQL Server license resource. + */ +@Fluent +public final class SqlServerLicenseUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * null + */ + private SqlServerLicenseUpdateProperties properties; + + /** + * Creates an instance of SqlServerLicenseUpdate class. + */ + public SqlServerLicenseUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the SqlServerLicenseUpdate object itself. + */ + public SqlServerLicenseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: null. + * + * @return the properties value. + */ + public SqlServerLicenseUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: null. + * + * @param properties the properties value to set. + * @return the SqlServerLicenseUpdate object itself. + */ + public SqlServerLicenseUpdate withProperties(SqlServerLicenseUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerLicenseUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerLicenseUpdate if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerLicenseUpdate. + */ + public static SqlServerLicenseUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerLicenseUpdate deserializedSqlServerLicenseUpdate = new SqlServerLicenseUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerLicenseUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedSqlServerLicenseUpdate.properties = SqlServerLicenseUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerLicenseUpdate; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseUpdateProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseUpdateProperties.java new file mode 100644 index 000000000000..7b868f121a6a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseUpdateProperties.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Properties of update SqlServerLicense. + */ +@Fluent +public final class SqlServerLicenseUpdateProperties implements JsonSerializable { + /* + * SQL Server license type. + */ + private BillingPlan billingPlan; + + /* + * The number of total cores of the license covers. + */ + private Integer physicalCores; + + /* + * This property represents the choice between SQL Server Core and ESU licenses. + */ + private LicenseCategory licenseCategory; + + /* + * The activation state of the license. + */ + private ActivationState activationState; + + /* + * The Azure scope to which the license will apply. + */ + private ScopeType scopeType; + + /* + * The timestamp of the most recent activation of the SqlServerLicense. + */ + private OffsetDateTime lastActivatedAt; + + /* + * The timestamp of the most recent deactivation of the SqlServerLicense. + */ + private OffsetDateTime lastDeactivatedAt; + + /* + * The tenantId the SQL Server license resource subscription resides in. + */ + private String tenantId; + + /** + * Creates an instance of SqlServerLicenseUpdateProperties class. + */ + public SqlServerLicenseUpdateProperties() { + } + + /** + * Get the billingPlan property: SQL Server license type. + * + * @return the billingPlan value. + */ + public BillingPlan billingPlan() { + return this.billingPlan; + } + + /** + * Set the billingPlan property: SQL Server license type. + * + * @param billingPlan the billingPlan value to set. + * @return the SqlServerLicenseUpdateProperties object itself. + */ + public SqlServerLicenseUpdateProperties withBillingPlan(BillingPlan billingPlan) { + this.billingPlan = billingPlan; + return this; + } + + /** + * Get the physicalCores property: The number of total cores of the license covers. + * + * @return the physicalCores value. + */ + public Integer physicalCores() { + return this.physicalCores; + } + + /** + * Set the physicalCores property: The number of total cores of the license covers. + * + * @param physicalCores the physicalCores value to set. + * @return the SqlServerLicenseUpdateProperties object itself. + */ + public SqlServerLicenseUpdateProperties withPhysicalCores(Integer physicalCores) { + this.physicalCores = physicalCores; + return this; + } + + /** + * Get the licenseCategory property: This property represents the choice between SQL Server Core and ESU licenses. + * + * @return the licenseCategory value. + */ + public LicenseCategory licenseCategory() { + return this.licenseCategory; + } + + /** + * Set the licenseCategory property: This property represents the choice between SQL Server Core and ESU licenses. + * + * @param licenseCategory the licenseCategory value to set. + * @return the SqlServerLicenseUpdateProperties object itself. + */ + public SqlServerLicenseUpdateProperties withLicenseCategory(LicenseCategory licenseCategory) { + this.licenseCategory = licenseCategory; + return this; + } + + /** + * Get the activationState property: The activation state of the license. + * + * @return the activationState value. + */ + public ActivationState activationState() { + return this.activationState; + } + + /** + * Set the activationState property: The activation state of the license. + * + * @param activationState the activationState value to set. + * @return the SqlServerLicenseUpdateProperties object itself. + */ + public SqlServerLicenseUpdateProperties withActivationState(ActivationState activationState) { + this.activationState = activationState; + return this; + } + + /** + * Get the scopeType property: The Azure scope to which the license will apply. + * + * @return the scopeType value. + */ + public ScopeType scopeType() { + return this.scopeType; + } + + /** + * Set the scopeType property: The Azure scope to which the license will apply. + * + * @param scopeType the scopeType value to set. + * @return the SqlServerLicenseUpdateProperties object itself. + */ + public SqlServerLicenseUpdateProperties withScopeType(ScopeType scopeType) { + this.scopeType = scopeType; + return this; + } + + /** + * Get the lastActivatedAt property: The timestamp of the most recent activation of the SqlServerLicense. + * + * @return the lastActivatedAt value. + */ + public OffsetDateTime lastActivatedAt() { + return this.lastActivatedAt; + } + + /** + * Get the lastDeactivatedAt property: The timestamp of the most recent deactivation of the SqlServerLicense. + * + * @return the lastDeactivatedAt value. + */ + public OffsetDateTime lastDeactivatedAt() { + return this.lastDeactivatedAt; + } + + /** + * Get the tenantId property: The tenantId the SQL Server license resource subscription resides in. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("billingPlan", this.billingPlan == null ? null : this.billingPlan.toString()); + jsonWriter.writeNumberField("physicalCores", this.physicalCores); + jsonWriter.writeStringField("licenseCategory", + this.licenseCategory == null ? null : this.licenseCategory.toString()); + jsonWriter.writeStringField("activationState", + this.activationState == null ? null : this.activationState.toString()); + jsonWriter.writeStringField("scopeType", this.scopeType == null ? null : this.scopeType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerLicenseUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerLicenseUpdateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerLicenseUpdateProperties. + */ + public static SqlServerLicenseUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerLicenseUpdateProperties deserializedSqlServerLicenseUpdateProperties + = new SqlServerLicenseUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("billingPlan".equals(fieldName)) { + deserializedSqlServerLicenseUpdateProperties.billingPlan + = BillingPlan.fromString(reader.getString()); + } else if ("physicalCores".equals(fieldName)) { + deserializedSqlServerLicenseUpdateProperties.physicalCores = reader.getNullable(JsonReader::getInt); + } else if ("licenseCategory".equals(fieldName)) { + deserializedSqlServerLicenseUpdateProperties.licenseCategory + = LicenseCategory.fromString(reader.getString()); + } else if ("activationState".equals(fieldName)) { + deserializedSqlServerLicenseUpdateProperties.activationState + = ActivationState.fromString(reader.getString()); + } else if ("scopeType".equals(fieldName)) { + deserializedSqlServerLicenseUpdateProperties.scopeType = ScopeType.fromString(reader.getString()); + } else if ("lastActivatedAt".equals(fieldName)) { + deserializedSqlServerLicenseUpdateProperties.lastActivatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastDeactivatedAt".equals(fieldName)) { + deserializedSqlServerLicenseUpdateProperties.lastDeactivatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedSqlServerLicenseUpdateProperties.tenantId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerLicenseUpdateProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenses.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenses.java new file mode 100644 index 000000000000..eba9beebfbe9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenses.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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 SqlServerLicenses. + */ +public interface SqlServerLicenses { + /** + * List sqlServerLicense resources in the 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 SQL Server licenses as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List sqlServerLicense resources in the 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 SQL Server licenses as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlServerLicenses in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlServerLicenses in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String sqlServerLicenseName, + Context context); + + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource. + */ + SqlServerLicense getByResourceGroup(String resourceGroupName, String sqlServerLicenseName); + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String sqlServerLicenseName, + Context context); + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 sqlServerLicenseName); + + /** + * Retrieves a SQL Server license resource. + * + * @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 describe SQL Server license resource along with {@link Response}. + */ + SqlServerLicense getById(String id); + + /** + * Retrieves a SQL Server license resource. + * + * @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 describe SQL Server license resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a SQL Server license resource. + * + * @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 SQL Server license resource. + * + * @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 the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SqlServerLicense resource. + * + * @param name resource name. + * @return the first stage of the new SqlServerLicense definition. + */ + SqlServerLicense.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlVersion.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlVersion.java index 8dbcc29ab7e8..96fdd7d40adb 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlVersion.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlVersion.java @@ -5,23 +5,50 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** SQL Server version. */ +/** + * SQL Server version. + */ public final class SqlVersion extends ExpandableStringEnum { - /** Static value SQL Server 2019 for SqlVersion. */ - public static final SqlVersion SQL_SERVER_2019 = fromString("SQL Server 2019"); + /** + * Static value SQL Server 2012 for SqlVersion. + */ + public static final SqlVersion SQL_SERVER_2012 = fromString("SQL Server 2012"); - /** Static value SQL Server 2017 for SqlVersion. */ - public static final SqlVersion SQL_SERVER_2017 = fromString("SQL Server 2017"); + /** + * Static value SQL Server 2014 for SqlVersion. + */ + public static final SqlVersion SQL_SERVER_2014 = fromString("SQL Server 2014"); - /** Static value SQL Server 2016 for SqlVersion. */ + /** + * Static value SQL Server 2016 for SqlVersion. + */ public static final SqlVersion SQL_SERVER_2016 = fromString("SQL Server 2016"); + /** + * Static value SQL Server 2017 for SqlVersion. + */ + public static final SqlVersion SQL_SERVER_2017 = fromString("SQL Server 2017"); + + /** + * Static value SQL Server 2019 for SqlVersion. + */ + public static final SqlVersion SQL_SERVER_2019 = fromString("SQL Server 2019"); + + /** + * Static value SQL Server 2022 for SqlVersion. + */ + public static final SqlVersion SQL_SERVER_2022 = fromString("SQL Server 2022"); + + /** + * Static value Unknown for SqlVersion. + */ + public static final SqlVersion UNKNOWN = fromString("Unknown"); + /** * Creates a new instance of SqlVersion value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -30,18 +57,17 @@ public SqlVersion() { /** * Creates or finds a SqlVersion from its string representation. - * + * * @param name a name to look for. * @return the corresponding SqlVersion. */ - @JsonCreator public static SqlVersion fromString(String name) { return fromString(name, SqlVersion.class); } /** * Gets known SqlVersion values. - * + * * @return known SqlVersion values. */ public static Collection values() { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/State.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/State.java new file mode 100644 index 000000000000..57bfe1f96ae4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/State.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The activation state of the license. + */ +public final class State extends ExpandableStringEnum { + /** + * Static value Inactive for State. + */ + public static final State INACTIVE = fromString("Inactive"); + + /** + * Static value Active for State. + */ + public static final State ACTIVE = fromString("Active"); + + /** + * Static value Terminated for State. + */ + public static final State TERMINATED = fromString("Terminated"); + + /** + * Static value Enabled for State. + */ + public static final State ENABLED = fromString("Enabled"); + + /** + * Static value Disabled for State. + */ + public static final State DISABLED = fromString("Disabled"); + + /** + * Static value Deleted for State. + */ + public static final State DELETED = fromString("Deleted"); + + /** + * Static value Completed for State. + */ + public static final State COMPLETED = fromString("Completed"); + + /** + * Static value Faulted for State. + */ + public static final State FAULTED = fromString("Faulted"); + + /** + * Static value Suspended for State. + */ + public static final State SUSPENDED = fromString("Suspended"); + + /** + * Creates a new instance of State value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public State() { + } + + /** + * Creates or finds a State from its string representation. + * + * @param name a name to look for. + * @return the corresponding State. + */ + public static State fromString(String name) { + return fromString(name, State.class); + } + + /** + * Gets known State values. + * + * @return known State values. + */ + public static Collection values() { + return values(State.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/TargetReadiness.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/TargetReadiness.java new file mode 100644 index 000000000000..cabe0164e0b4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/TargetReadiness.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The target readiness for migration for this database. + */ +@Fluent +public final class TargetReadiness implements JsonSerializable { + /* + * The SKU recommendation summary. + */ + private SkuRecommendationSummary azureSqlDatabase; + + /* + * The SKU recommendation summary. + */ + private SkuRecommendationSummary azureSqlManagedInstance; + + /* + * The SKU recommendation summary. + */ + private SkuRecommendationSummary azureSqlVirtualMachine; + + /** + * Creates an instance of TargetReadiness class. + */ + public TargetReadiness() { + } + + /** + * Get the azureSqlDatabase property: The SKU recommendation summary. + * + * @return the azureSqlDatabase value. + */ + public SkuRecommendationSummary azureSqlDatabase() { + return this.azureSqlDatabase; + } + + /** + * Set the azureSqlDatabase property: The SKU recommendation summary. + * + * @param azureSqlDatabase the azureSqlDatabase value to set. + * @return the TargetReadiness object itself. + */ + public TargetReadiness withAzureSqlDatabase(SkuRecommendationSummary azureSqlDatabase) { + this.azureSqlDatabase = azureSqlDatabase; + return this; + } + + /** + * Get the azureSqlManagedInstance property: The SKU recommendation summary. + * + * @return the azureSqlManagedInstance value. + */ + public SkuRecommendationSummary azureSqlManagedInstance() { + return this.azureSqlManagedInstance; + } + + /** + * Set the azureSqlManagedInstance property: The SKU recommendation summary. + * + * @param azureSqlManagedInstance the azureSqlManagedInstance value to set. + * @return the TargetReadiness object itself. + */ + public TargetReadiness withAzureSqlManagedInstance(SkuRecommendationSummary azureSqlManagedInstance) { + this.azureSqlManagedInstance = azureSqlManagedInstance; + return this; + } + + /** + * Get the azureSqlVirtualMachine property: The SKU recommendation summary. + * + * @return the azureSqlVirtualMachine value. + */ + public SkuRecommendationSummary azureSqlVirtualMachine() { + return this.azureSqlVirtualMachine; + } + + /** + * Set the azureSqlVirtualMachine property: The SKU recommendation summary. + * + * @param azureSqlVirtualMachine the azureSqlVirtualMachine value to set. + * @return the TargetReadiness object itself. + */ + public TargetReadiness withAzureSqlVirtualMachine(SkuRecommendationSummary azureSqlVirtualMachine) { + this.azureSqlVirtualMachine = azureSqlVirtualMachine; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (azureSqlDatabase() != null) { + azureSqlDatabase().validate(); + } + if (azureSqlManagedInstance() != null) { + azureSqlManagedInstance().validate(); + } + if (azureSqlVirtualMachine() != null) { + azureSqlVirtualMachine().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("azureSqlDatabase", this.azureSqlDatabase); + jsonWriter.writeJsonField("azureSqlManagedInstance", this.azureSqlManagedInstance); + jsonWriter.writeJsonField("azureSqlVirtualMachine", this.azureSqlVirtualMachine); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TargetReadiness from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TargetReadiness if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TargetReadiness. + */ + public static TargetReadiness fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TargetReadiness deserializedTargetReadiness = new TargetReadiness(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureSqlDatabase".equals(fieldName)) { + deserializedTargetReadiness.azureSqlDatabase = SkuRecommendationSummary.fromJson(reader); + } else if ("azureSqlManagedInstance".equals(fieldName)) { + deserializedTargetReadiness.azureSqlManagedInstance = SkuRecommendationSummary.fromJson(reader); + } else if ("azureSqlVirtualMachine".equals(fieldName)) { + deserializedTargetReadiness.azureSqlVirtualMachine = SkuRecommendationSummary.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTargetReadiness; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadServicePrincipal.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadServicePrincipal.java index 0b71919a6a09..1002ef63302c 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadServicePrincipal.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadServicePrincipal.java @@ -5,43 +5,48 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Objects; import java.util.UUID; -/** Service principal for uploading billing, metrics and logs. */ +/** + * Service principal for uploading billing, metrics and logs. + */ @Fluent -public final class UploadServicePrincipal { +public final class UploadServicePrincipal implements JsonSerializable { /* * Client ID of the service principal for uploading data. */ - @JsonProperty(value = "clientId") private UUID clientId; /* * Tenant ID of the service principal. */ - @JsonProperty(value = "tenantId") private UUID tenantId; /* * Authority for the service principal. Example: https://login.microsoftonline.com/ */ - @JsonProperty(value = "authority") private String authority; /* * Secret of the service principal */ - @JsonProperty(value = "clientSecret") private String clientSecret; - /** Creates an instance of UploadServicePrincipal class. */ + /** + * Creates an instance of UploadServicePrincipal class. + */ public UploadServicePrincipal() { } /** * Get the clientId property: Client ID of the service principal for uploading data. - * + * * @return the clientId value. */ public UUID clientId() { @@ -50,7 +55,7 @@ public UUID clientId() { /** * Set the clientId property: Client ID of the service principal for uploading data. - * + * * @param clientId the clientId value to set. * @return the UploadServicePrincipal object itself. */ @@ -61,7 +66,7 @@ public UploadServicePrincipal withClientId(UUID clientId) { /** * Get the tenantId property: Tenant ID of the service principal. - * + * * @return the tenantId value. */ public UUID tenantId() { @@ -70,7 +75,7 @@ public UUID tenantId() { /** * Set the tenantId property: Tenant ID of the service principal. - * + * * @param tenantId the tenantId value to set. * @return the UploadServicePrincipal object itself. */ @@ -81,7 +86,7 @@ public UploadServicePrincipal withTenantId(UUID tenantId) { /** * Get the authority property: Authority for the service principal. Example: https://login.microsoftonline.com/. - * + * * @return the authority value. */ public String authority() { @@ -90,7 +95,7 @@ public String authority() { /** * Set the authority property: Authority for the service principal. Example: https://login.microsoftonline.com/. - * + * * @param authority the authority value to set. * @return the UploadServicePrincipal object itself. */ @@ -101,7 +106,7 @@ public UploadServicePrincipal withAuthority(String authority) { /** * Get the clientSecret property: Secret of the service principal. - * + * * @return the clientSecret value. */ public String clientSecret() { @@ -110,7 +115,7 @@ public String clientSecret() { /** * Set the clientSecret property: Secret of the service principal. - * + * * @param clientSecret the clientSecret value to set. * @return the UploadServicePrincipal object itself. */ @@ -121,9 +126,56 @@ public UploadServicePrincipal withClientSecret(String clientSecret) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("clientId", Objects.toString(this.clientId, null)); + jsonWriter.writeStringField("tenantId", Objects.toString(this.tenantId, null)); + jsonWriter.writeStringField("authority", this.authority); + jsonWriter.writeStringField("clientSecret", this.clientSecret); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UploadServicePrincipal from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UploadServicePrincipal if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the UploadServicePrincipal. + */ + public static UploadServicePrincipal fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UploadServicePrincipal deserializedUploadServicePrincipal = new UploadServicePrincipal(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("clientId".equals(fieldName)) { + deserializedUploadServicePrincipal.clientId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedUploadServicePrincipal.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("authority".equals(fieldName)) { + deserializedUploadServicePrincipal.authority = reader.getString(); + } else if ("clientSecret".equals(fieldName)) { + deserializedUploadServicePrincipal.clientSecret = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUploadServicePrincipal; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadWatermark.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadWatermark.java index 0f0142a2cff6..641e1dc45778 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadWatermark.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadWatermark.java @@ -5,37 +5,44 @@ package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; -/** Properties on upload watermark. Mostly timestamp for each upload data type. */ +/** + * Properties on upload watermark. Mostly timestamp for each upload data type. + */ @Fluent -public final class UploadWatermark { +public final class UploadWatermark implements JsonSerializable { /* * Last uploaded date for metrics from kubernetes cluster. Defaults to current date time */ - @JsonProperty(value = "metrics") private OffsetDateTime metrics; /* * Last uploaded date for logs from kubernetes cluster. Defaults to current date time */ - @JsonProperty(value = "logs") private OffsetDateTime logs; /* * Last uploaded date for usages from kubernetes cluster. Defaults to current date time */ - @JsonProperty(value = "usages") private OffsetDateTime usages; - /** Creates an instance of UploadWatermark class. */ + /** + * Creates an instance of UploadWatermark class. + */ public UploadWatermark() { } /** * Get the metrics property: Last uploaded date for metrics from kubernetes cluster. Defaults to current date time. - * + * * @return the metrics value. */ public OffsetDateTime metrics() { @@ -44,7 +51,7 @@ public OffsetDateTime metrics() { /** * Set the metrics property: Last uploaded date for metrics from kubernetes cluster. Defaults to current date time. - * + * * @param metrics the metrics value to set. * @return the UploadWatermark object itself. */ @@ -55,7 +62,7 @@ public UploadWatermark withMetrics(OffsetDateTime metrics) { /** * Get the logs property: Last uploaded date for logs from kubernetes cluster. Defaults to current date time. - * + * * @return the logs value. */ public OffsetDateTime logs() { @@ -64,7 +71,7 @@ public OffsetDateTime logs() { /** * Set the logs property: Last uploaded date for logs from kubernetes cluster. Defaults to current date time. - * + * * @param logs the logs value to set. * @return the UploadWatermark object itself. */ @@ -75,7 +82,7 @@ public UploadWatermark withLogs(OffsetDateTime logs) { /** * Get the usages property: Last uploaded date for usages from kubernetes cluster. Defaults to current date time. - * + * * @return the usages value. */ public OffsetDateTime usages() { @@ -84,7 +91,7 @@ public OffsetDateTime usages() { /** * Set the usages property: Last uploaded date for usages from kubernetes cluster. Defaults to current date time. - * + * * @param usages the usages value to set. * @return the UploadWatermark object itself. */ @@ -95,9 +102,57 @@ public UploadWatermark withUsages(OffsetDateTime usages) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("metrics", + this.metrics == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.metrics)); + jsonWriter.writeStringField("logs", + this.logs == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.logs)); + jsonWriter.writeStringField("usages", + this.usages == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.usages)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UploadWatermark from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UploadWatermark if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the UploadWatermark. + */ + public static UploadWatermark fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UploadWatermark deserializedUploadWatermark = new UploadWatermark(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("metrics".equals(fieldName)) { + deserializedUploadWatermark.metrics = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("logs".equals(fieldName)) { + deserializedUploadWatermark.logs = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("usages".equals(fieldName)) { + deserializedUploadWatermark.usages = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedUploadWatermark; + }); + } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Version.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Version.java new file mode 100644 index 000000000000..f2e3c1c520c6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Version.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.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The SQL Server version the license covers. + */ +public final class Version extends ExpandableStringEnum { + /** + * Static value SQL Server 2012 for Version. + */ + public static final Version SQL_SERVER_2012 = fromString("SQL Server 2012"); + + /** + * Static value SQL Server 2014 for Version. + */ + public static final Version SQL_SERVER_2014 = fromString("SQL Server 2014"); + + /** + * Creates a new instance of Version value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Version() { + } + + /** + * Creates or finds a Version from its string representation. + * + * @param name a name to look for. + * @return the corresponding Version. + */ + public static Version fromString(String name) { + return fromString(name, Version.class); + } + + /** + * Gets known Version values. + * + * @return known Version values. + */ + public static Collection values() { + return values(Version.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/package-info.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/package-info.java index a0367286bf1e..f38a598a4bb8 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/package-info.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/package-info.java @@ -3,7 +3,8 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * Package containing the data models for AzureArcDataManagementClient. The AzureArcData management API provides a - * RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. + * Package containing the data models for AzureArcDataManagementClient. + * The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc + * Resources. */ package com.azure.resourcemanager.azurearcdata.models; diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/package-info.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/package-info.java index 8a7b18446621..d6ef1b9ec709 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/package-info.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/package-info.java @@ -3,7 +3,8 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * Package containing the classes for AzureArcDataManagementClient. The AzureArcData management API provides a RESTful - * set of web APIs to manage Azure Data Services on Azure Arc Resources. + * Package containing the classes for AzureArcDataManagementClient. + * The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc + * Resources. */ package com.azure.resourcemanager.azurearcdata; diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/module-info.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/module-info.java index 667d73e9b6e2..13cc7832a889 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/module-info.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/module-info.java @@ -10,10 +10,6 @@ exports com.azure.resourcemanager.azurearcdata.fluent.models; exports com.azure.resourcemanager.azurearcdata.models; - opens com.azure.resourcemanager.azurearcdata.fluent.models to - com.azure.core, - com.fasterxml.jackson.databind; - opens com.azure.resourcemanager.azurearcdata.models to - com.azure.core, - com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.azurearcdata.fluent.models to com.azure.core; + opens com.azure.resourcemanager.azurearcdata.models to com.azure.core; } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurearcdata/proxy-config.json b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurearcdata/proxy-config.json new file mode 100644 index 000000000000..920b3cb2bd9e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurearcdata/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.azurearcdata.implementation.ActiveDirectoryConnectorsClientImpl$ActiveDirectoryConnectorsService"],["com.azure.resourcemanager.azurearcdata.implementation.DataControllersClientImpl$DataControllersService"],["com.azure.resourcemanager.azurearcdata.implementation.FailoverGroupsClientImpl$FailoverGroupsService"],["com.azure.resourcemanager.azurearcdata.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.azurearcdata.implementation.PostgresInstancesClientImpl$PostgresInstancesService"],["com.azure.resourcemanager.azurearcdata.implementation.SqlManagedInstancesClientImpl$SqlManagedInstancesService"],["com.azure.resourcemanager.azurearcdata.implementation.SqlServerAvailabilityGroupsClientImpl$SqlServerAvailabilityGroupsService"],["com.azure.resourcemanager.azurearcdata.implementation.SqlServerDatabasesClientImpl$SqlServerDatabasesService"],["com.azure.resourcemanager.azurearcdata.implementation.SqlServerEsuLicensesClientImpl$SqlServerEsuLicensesService"],["com.azure.resourcemanager.azurearcdata.implementation.SqlServerInstancesClientImpl$SqlServerInstancesService"],["com.azure.resourcemanager.azurearcdata.implementation.SqlServerLicensesClientImpl$SqlServerLicensesService"]] \ No newline at end of file diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurearcdata/reflect-config.json b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurearcdata/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurearcdata/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsCreateSamples.java new file mode 100644 index 000000000000..1e9f53dbf79b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsCreateSamples.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.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.AccountProvisioningMode; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorDnsDetails; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorDomainDetails; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorProperties; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorSpec; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainController; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainControllers; +import java.util.Arrays; + +/** + * Samples for ActiveDirectoryConnectors Create. + */ +public final class ActiveDirectoryConnectorsCreateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateActiveDirectoryConnector.json + */ + /** + * Sample code: Create or update an Active Directory connector instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createOrUpdateAnActiveDirectoryConnectorInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.activeDirectoryConnectors() + .define("testADConnector") + .withExistingDataController("testrg", "testdataController") + .withProperties(new ActiveDirectoryConnectorProperties().withSpec(new ActiveDirectoryConnectorSpec() + .withActiveDirectory(new ActiveDirectoryConnectorDomainDetails().withRealm("CONTOSO.LOCAL") + .withServiceAccountProvisioning(AccountProvisioningMode.MANUAL) + .withDomainControllers(new ActiveDirectoryDomainControllers() + .withPrimaryDomainController( + new ActiveDirectoryDomainController().withHostname("dc1.contoso.local")) + .withSecondaryDomainControllers( + Arrays.asList(new ActiveDirectoryDomainController().withHostname("dc2.contoso.local"), + new ActiveDirectoryDomainController().withHostname("dc3.contoso.local"))))) + .withDns(new ActiveDirectoryConnectorDnsDetails() + .withNameserverIpAddresses(Arrays.asList("11.11.111.111", "22.22.222.222")) + .withReplicas(1L) + .withPreferK8SDnsForPtrLookups(false)))) + .create(); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsDeleteSamples.java new file mode 100644 index 000000000000..2c431fd53b74 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for ActiveDirectoryConnectors Delete. + */ +public final class ActiveDirectoryConnectorsDeleteSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteActiveDirectoryConnector.json + */ + /** + * Sample code: Deletes an Active Directory connector instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + deletesAnActiveDirectoryConnectorInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.activeDirectoryConnectors() + .delete("testrg", "testdataController", "testADConnector", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsGetSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsGetSamples.java new file mode 100644 index 000000000000..bb013be1e756 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for ActiveDirectoryConnectors Get. + */ +public final class ActiveDirectoryConnectorsGetSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetActiveDirectoryConnector.json + */ + /** + * Sample code: Retrieves an Active Directory connector resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesAnActiveDirectoryConnectorResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.activeDirectoryConnectors() + .getWithResponse("testrg", "testdataController", "testADConnector", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsListSamples.java new file mode 100644 index 000000000000..4b9192fe9b41 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsListSamples.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.azurearcdata.generated; + +/** + * Samples for ActiveDirectoryConnectors List. + */ +public final class ActiveDirectoryConnectorsListSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListByDataControllerActiveDirectoryConnector.json + */ + /** + * Sample code: Gets all Active Directory connectors associated with a data controller. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllActiveDirectoryConnectorsAssociatedWithADataController( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.activeDirectoryConnectors().list("testrg", "testdataController", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersDeleteSamples.java index fdce4b6505ed..0c2a8c61532d 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersDeleteSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersDeleteSamples.java @@ -4,14 +4,18 @@ package com.azure.resourcemanager.azurearcdata.generated; -/** Samples for DataControllers Delete. */ +/** + * Samples for DataControllers Delete. + */ public final class DataControllersDeleteSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/DeleteDataController.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteDataController.json */ /** * Sample code: Delete a dataController. - * + * * @param manager Entry point to AzureArcDataManager. */ public static void deleteADataController(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersGetByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersGetByResourceGroupSamples.java index 99295ef1ce3e..aaff3a41ab31 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersGetByResourceGroupSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersGetByResourceGroupSamples.java @@ -4,19 +4,22 @@ package com.azure.resourcemanager.azurearcdata.generated; -/** Samples for DataControllers GetByResourceGroup. */ +/** + * Samples for DataControllers GetByResourceGroup. + */ public final class DataControllersGetByResourceGroupSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/GetDataController.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetDataController.json */ /** * Sample code: Get a data controller. - * + * * @param manager Entry point to AzureArcDataManager. */ public static void getADataController(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager - .dataControllers() + manager.dataControllers() .getByResourceGroupWithResponse("testrg", "testdataController", com.azure.core.util.Context.NONE); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersListByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersListByResourceGroupSamples.java index cc41f26d8769..8af8df948b80 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersListByResourceGroupSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersListByResourceGroupSamples.java @@ -4,18 +4,22 @@ package com.azure.resourcemanager.azurearcdata.generated; -/** Samples for DataControllers ListByResourceGroup. */ +/** + * Samples for DataControllers ListByResourceGroup. + */ public final class DataControllersListByResourceGroupSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ListByResourceGroupDataController.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListByResourceGroupDataController.json */ /** * Sample code: Gets all dataControllers in a resource group. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void getsAllDataControllersInAResourceGroup( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + public static void + getsAllDataControllersInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { manager.dataControllers().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersListSamples.java index 0d5b17a4559c..6f4cc4e1538f 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersListSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersListSamples.java @@ -4,18 +4,22 @@ package com.azure.resourcemanager.azurearcdata.generated; -/** Samples for DataControllers List. */ +/** + * Samples for DataControllers List. + */ public final class DataControllersListSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ListSubscriptionDataController.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListSubscriptionDataController.json */ /** * Sample code: Gets all dataControllers in a subscription. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void getsAllDataControllersInASubscription( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + public static void + getsAllDataControllersInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { manager.dataControllers().list(com.azure.core.util.Context.NONE); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersPatchDataControllerSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersPatchDataControllerSamples.java index 2602faf471e8..2e965e785a8b 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersPatchDataControllerSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersPatchDataControllerSamples.java @@ -8,25 +8,28 @@ import java.util.HashMap; import java.util.Map; -/** Samples for DataControllers PatchDataController. */ +/** + * Samples for DataControllers PatchDataController. + */ public final class DataControllersPatchDataControllerSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/UpdateDataController.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * UpdateDataController.json */ /** * Sample code: Updates a dataController tags. - * + * * @param manager Entry point to AzureArcDataManager. */ public static void updatesADataControllerTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - DataControllerResource resource = - manager - .dataControllers() - .getByResourceGroupWithResponse("testrg", "testdataController1", com.azure.core.util.Context.NONE) - .getValue(); + DataControllerResource resource = manager.dataControllers() + .getByResourceGroupWithResponse("testrg", "testdataController1", com.azure.core.util.Context.NONE) + .getValue(); resource.update().withTags(mapOf("mytag", "myval")).apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersPutDataControllerSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersPutDataControllerSamples.java index ae41477ac21f..6561994fb166 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersPutDataControllerSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersPutDataControllerSamples.java @@ -18,60 +18,60 @@ import java.util.Map; import java.util.UUID; -/** Samples for DataControllers PutDataController. */ +/** + * Samples for DataControllers PutDataController. + */ public final class DataControllersPutDataControllerSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/CreateOrUpdateDataController.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateDataController.json */ /** * Sample code: Create or update a Data Controller. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void createOrUpdateADataController( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager - .dataControllers() + public static void + createOrUpdateADataController(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.dataControllers() .define("testdataController") .withRegion("northeurope") .withExistingResourceGroup("testrg") - .withProperties( - new DataControllerProperties() - .withInfrastructure(Infrastructure.ONPREMISES) - .withOnPremiseProperty( - new OnPremiseProperty() - .withId(UUID.fromString("12345678-1234-1234-ab12-1a2b3c4d5e6f")) - .withPublicSigningKey("fakeTokenPlaceholder")) - .withUploadWatermark( - new UploadWatermark() - .withMetrics(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z")) - .withLogs(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z")) - .withUsages(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z"))) - .withBasicLoginInformation( - new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) - .withLogAnalyticsWorkspaceConfig( - new LogAnalyticsWorkspaceConfig() - .withWorkspaceId(UUID.fromString("00000000-1111-2222-3333-444444444444")) - .withPrimaryKey("fakeTokenPlaceholder")) - .withUploadServicePrincipal( - new UploadServicePrincipal() - .withClientId(UUID.fromString("00000000-1111-2222-3333-444444444444")) - .withTenantId(UUID.fromString("00000000-1111-2222-3333-444444444444")) - .withAuthority("https://login.microsoftonline.com/") - .withClientSecret("fakeTokenPlaceholder")) - .withClusterId( - "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s") - .withExtensionId( - "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension")) + .withProperties(new DataControllerProperties().withInfrastructure(Infrastructure.ONPREMISES) + .withOnPremiseProperty( + new OnPremiseProperty().withId(UUID.fromString("12345678-1234-1234-ab12-1a2b3c4d5e6f")) + .withPublicSigningKey("fakeTokenPlaceholder")) + .withUploadWatermark( + new UploadWatermark().withMetrics(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z")) + .withLogs(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z")) + .withUsages(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z"))) + .withBasicLoginInformation( + new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withMetricsDashboardCredential( + new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withLogsDashboardCredential( + new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withLogAnalyticsWorkspaceConfig(new LogAnalyticsWorkspaceConfig() + .withWorkspaceId(UUID.fromString("00000000-1111-2222-3333-444444444444")) + .withPrimaryKey("fakeTokenPlaceholder")) + .withUploadServicePrincipal( + new UploadServicePrincipal().withClientId(UUID.fromString("00000000-1111-2222-3333-444444444444")) + .withTenantId(UUID.fromString("00000000-1111-2222-3333-444444444444")) + .withAuthority("https://login.microsoftonline.com/") + .withClientSecret("fakeTokenPlaceholder")) + .withClusterId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s") + .withExtensionId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension")) .withTags(mapOf("mytag", "myval")) - .withExtendedLocation( - new ExtendedLocation() - .withName( - "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation") - .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsCreateSamples.java new file mode 100644 index 000000000000..90fecc50e2e4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsCreateSamples.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.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupPartnerSyncMode; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupProperties; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupSpec; +import com.azure.resourcemanager.azurearcdata.models.InstanceFailoverGroupRole; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for FailoverGroups Create. + */ +public final class FailoverGroupsCreateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateFailoverGroup.json + */ + /** + * Sample code: Create or update a failover group instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + createOrUpdateAFailoverGroupInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.failoverGroups() + .define("testFailoverGroupName") + .withExistingSqlManagedInstance("testrg", "testSqlManagedInstance") + .withProperties(new FailoverGroupProperties().withPartnerManagedInstanceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlManagedInstances/partnerMI") + .withSpec(new FailoverGroupSpec().withPartnerSyncMode(FailoverGroupPartnerSyncMode.ASYNC) + .withRole(InstanceFailoverGroupRole.PRIMARY) + .withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf())) + .create(); + } + + // Use "Map.of" if available + @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/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsDeleteSamples.java new file mode 100644 index 000000000000..37694b129929 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for FailoverGroups Delete. + */ +public final class FailoverGroupsDeleteSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteFailoverGroup.json + */ + /** + * Sample code: Deletes a failover group instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + deletesAFailoverGroupInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.failoverGroups() + .delete("testrg", "testSqlManagedInstance", "testFailoverGroupName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsGetSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsGetSamples.java new file mode 100644 index 000000000000..d3da3c79a955 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsGetSamples.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.azurearcdata.generated; + +/** + * Samples for FailoverGroups Get. + */ +public final class FailoverGroupsGetSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetFailoverGroup.json + */ + /** + * Sample code: Retrieves a failover group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + retrievesAFailoverGroupResource(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.failoverGroups() + .getWithResponse("testrg", "testSqlManagedInstance", "testFailoverGroupName", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsListSamples.java new file mode 100644 index 000000000000..21051a88c0c1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsListSamples.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.azurearcdata.generated; + +/** + * Samples for FailoverGroups List. + */ +public final class FailoverGroupsListSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListBySqlManagedInstanceFailoverGroup.json + */ + /** + * Sample code: Gets all failover groups associated with a sql managed instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllFailoverGroupsAssociatedWithASqlManagedInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.failoverGroups().list("testrg", "testSqlManagedInstance", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/OperationsListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/OperationsListSamples.java index 43f38fb8a5ca..18c302aaf690 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/OperationsListSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/OperationsListSamples.java @@ -4,14 +4,18 @@ package com.azure.resourcemanager.azurearcdata.generated; -/** Samples for Operations List. */ +/** + * Samples for Operations List. + */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ListOperation.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListOperation.json */ /** * Sample code: Lists all of the available Azure Data Services on Azure Arc API operations. - * + * * @param manager Entry point to AzureArcDataManager. */ public static void listsAllOfTheAvailableAzureDataServicesOnAzureArcAPIOperations( diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesCreateSamples.java new file mode 100644 index 000000000000..a503a57694df --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesCreateSamples.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.azurearcdata.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.azurearcdata.models.BasicLoginInformation; +import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; +import com.azure.resourcemanager.azurearcdata.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceProperties; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSku; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSkuTier; +import java.io.IOException; + +/** + * Samples for PostgresInstances Create. + */ +public final class PostgresInstancesCreateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdatePostgresInstance.json + */ + /** + * Sample code: Create or update a Postgres Instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createOrUpdateAPostgresInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) throws IOException { + manager.postgresInstances() + .define("testpostgresInstance") + .withRegion("eastus") + .withExistingResourceGroup("testrg") + .withProperties(new PostgresInstanceProperties().withDataControllerId("dataControllerId") + .withAdmin("admin") + .withBasicLoginInformation( + new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withK8SRaw(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"apiVersion\":\"apiVersion\",\"kind\":\"postgresql-12\",\"metadata\":{\"name\":\"pg1\",\"creationTimestamp\":\"2020-08-25T14:55:10Z\",\"generation\":1,\"namespace\":\"test\",\"resourceVersion\":\"527780\",\"selfLink\":\"/apis/arcdata.microsoft.com/v1alpha1/namespaces/test/postgresql-12s/pg1\",\"uid\":\"1111aaaa-ffff-ffff-ffff-99999aaaaaaa\"},\"spec\":{\"backups\":{\"deltaMinutes\":3,\"fullMinutes\":10,\"tiers\":[{\"retention\":{\"maximums\":[\"6\",\"512MB\"],\"minimums\":[\"3\"]},\"storage\":{\"volumeSize\":\"1Gi\"}}]},\"engine\":{\"extensions\":[{\"name\":\"citus\"}]},\"scale\":{\"shards\":3},\"scheduling\":{\"default\":{\"resources\":{\"requests\":{\"memory\":\"256Mi\"}}}},\"service\":{\"type\":\"NodePort\"},\"storage\":{\"data\":{\"className\":\"local-storage\",\"size\":\"5Gi\"},\"logs\":{\"className\":\"local-storage\",\"size\":\"5Gi\"}}},\"status\":{\"externalEndpoint\":null,\"readyPods\":\"4/4\",\"state\":\"Ready\"}}", + Object.class, SerializerEncoding.JSON))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .withSku(new PostgresInstanceSku().withName("default") + .withDev(true) + .withTier(PostgresInstanceSkuTier.HYPERSCALE)) + .create(); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesDeleteSamples.java new file mode 100644 index 000000000000..ad95771d3bb3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesDeleteSamples.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.azurearcdata.generated; + +/** + * Samples for PostgresInstances Delete. + */ +public final class PostgresInstancesDeleteSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeletePostgresInstance.json + */ + /** + * Sample code: Deletes a PostgresInstances. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deletesAPostgresInstances(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances().delete("testrg", "testpostgresInstance", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesGetByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..2954fbf60c39 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesGetByResourceGroupSamples.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.azurearcdata.generated; + +/** + * Samples for PostgresInstances GetByResourceGroup. + */ +public final class PostgresInstancesGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetPostgresInstance.json + */ + /** + * Sample code: Gets a postgres Instances. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAPostgresInstances(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances() + .getByResourceGroupWithResponse("testrg", "testpostgresInstances", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesListByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesListByResourceGroupSamples.java new file mode 100644 index 000000000000..00138cfc2bdf --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesListByResourceGroupSamples.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.azurearcdata.generated; + +/** + * Samples for PostgresInstances ListByResourceGroup. + */ +public final class PostgresInstancesListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListByResourceGroupPostgresInstance.json + */ + /** + * Sample code: Gets all postgres Instances in a resource group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllPostgresInstancesInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesListSamples.java new file mode 100644 index 000000000000..1d5bbd74805c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesListSamples.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.azurearcdata.generated; + +/** + * Samples for PostgresInstances List. + */ +public final class PostgresInstancesListSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListSubscriptionPostgresInstance.json + */ + /** + * Sample code: Gets all Postgres Instance in a subscription. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllPostgresInstanceInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesUpdateSamples.java new file mode 100644 index 000000000000..9872c65efebd --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesUpdateSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.PostgresInstance; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for PostgresInstances Update. + */ +public final class PostgresInstancesUpdateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * UpdatePostgresInstance.json + */ + /** + * Sample code: Updates a postgres Instances tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + updatesAPostgresInstancesTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + PostgresInstance resource = manager.postgresInstances() + .getByResourceGroupWithResponse("testrg", "testpostgresInstance", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval")).apply(); + } + + // Use "Map.of" if available + @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/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesCreateSamples.java index 2e59be809ead..0d662df8e570 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesCreateSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesCreateSamples.java @@ -4,92 +4,108 @@ package com.azure.resourcemanager.azurearcdata.generated; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryInformation; import com.azure.resourcemanager.azurearcdata.models.ArcSqlManagedInstanceLicenseType; import com.azure.resourcemanager.azurearcdata.models.BasicLoginInformation; import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; import com.azure.resourcemanager.azurearcdata.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurearcdata.models.K8SActiveDirectory; +import com.azure.resourcemanager.azurearcdata.models.K8SActiveDirectoryConnector; +import com.azure.resourcemanager.azurearcdata.models.K8SNetworkSettings; import com.azure.resourcemanager.azurearcdata.models.K8SResourceRequirements; import com.azure.resourcemanager.azurearcdata.models.K8SScheduling; import com.azure.resourcemanager.azurearcdata.models.K8SSchedulingOptions; +import com.azure.resourcemanager.azurearcdata.models.K8SSecurity; +import com.azure.resourcemanager.azurearcdata.models.K8SSettings; +import com.azure.resourcemanager.azurearcdata.models.K8StransparentDataEncryption; +import com.azure.resourcemanager.azurearcdata.models.KeytabInformation; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SRaw; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SSpec; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceProperties; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceSku; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceSkuTier; +import java.util.Arrays; import java.util.HashMap; import java.util.Map; -/** Samples for SqlManagedInstances Create. */ +/** + * Samples for SqlManagedInstances Create. + */ public final class SqlManagedInstancesCreateSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/CreateOrUpdateSqlManagedInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateSqlManagedInstance.json */ /** * Sample code: Create or update a SQL Managed Instance. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void createOrUpdateASQLManagedInstance( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager - .sqlManagedInstances() + public static void + createOrUpdateASQLManagedInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlManagedInstances() .define("testsqlManagedInstance") .withRegion("northeurope") .withExistingResourceGroup("testrg") .withProperties( - new SqlManagedInstanceProperties() - .withAdmin("Admin user") + new SqlManagedInstanceProperties().withAdmin("Admin user") .withStartTime("Instance start time") .withEndTime("Instance end time") .withK8SRaw( new SqlManagedInstanceK8SRaw() - .withSpec( - new SqlManagedInstanceK8SSpec() - .withScheduling( - new K8SScheduling() - .withDefaultProperty( - new K8SSchedulingOptions() - .withResources( - new K8SResourceRequirements() - .withRequests( - mapOf( - "additionalProperty", - "additionalValue", - "cpu", - "1", - "memory", - "8Gi")) - .withLimits( - mapOf( - "additionalProperty", - "additionalValue", - "cpu", - "1", - "memory", - "8Gi")) - .withAdditionalProperties(mapOf())) + .withSpec(new SqlManagedInstanceK8SSpec() + .withScheduling( + new K8SScheduling() + .withDefaultProperty( + new K8SSchedulingOptions() + .withResources(new K8SResourceRequirements() + .withRequests(mapOf("additionalProperty", "additionalValue", "cpu", + "1", "memory", "8Gi")) + .withLimits(mapOf("additionalProperty", "additionalValue", "cpu", + "1", "memory", "8Gi")) .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf())) - .withReplicas(1) + .withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf())) + .withReplicas(1) + .withSecurity(new K8SSecurity() + .withAdminLoginSecret("fakeTokenPlaceholder") + .withServiceCertificateSecret("fakeTokenPlaceholder") + .withActiveDirectory(new K8SActiveDirectory() + .withConnector(new K8SActiveDirectoryConnector().withName("Name of connector") + .withNamespace("Namespace of connector")) + .withAccountName("Account name") + .withKeytabSecret("fakeTokenPlaceholder") + .withEncryptionTypes( + Arrays.asList("Encryption type item1, Encryption type item2,..."))) + .withTransparentDataEncryption( + new K8StransparentDataEncryption().withMode("SystemManaged")) .withAdditionalProperties(mapOf())) + .withSettings( + new K8SSettings().withNetwork(new K8SNetworkSettings().withForceencryption(0) + .withTlsciphers( + "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384") + .withTlsprotocols("1.2")).withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf())) .withAdditionalProperties(mapOf("additionalProperty", 1234))) .withBasicLoginInformation( new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withActiveDirectoryInformation(new ActiveDirectoryInformation() + .withKeytabInformation(new KeytabInformation().withKeytab("fakeTokenPlaceholder"))) .withLicenseType(ArcSqlManagedInstanceLicenseType.LICENSE_INCLUDED) .withClusterId( "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s") .withExtensionId( "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension")) .withTags(mapOf("mytag", "myval")) - .withExtendedLocation( - new ExtendedLocation() - .withName( - "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation") - .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) .withSku(new SqlManagedInstanceSku().withTier(SqlManagedInstanceSkuTier.GENERAL_PURPOSE).withDev(true)) .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesDeleteSamples.java index 4c51b38d1fb8..f071d52bc8e4 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesDeleteSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesDeleteSamples.java @@ -4,14 +4,18 @@ package com.azure.resourcemanager.azurearcdata.generated; -/** Samples for SqlManagedInstances Delete. */ +/** + * Samples for SqlManagedInstances Delete. + */ public final class SqlManagedInstancesDeleteSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/DeleteSqlManagedInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteSqlManagedInstance.json */ /** * Sample code: Delete a SQL Instance. - * + * * @param manager Entry point to AzureArcDataManager. */ public static void deleteASQLInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesGetByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesGetByResourceGroupSamples.java index ff11c40b3f57..0fa6f2e1192d 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesGetByResourceGroupSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesGetByResourceGroupSamples.java @@ -4,19 +4,22 @@ package com.azure.resourcemanager.azurearcdata.generated; -/** Samples for SqlManagedInstances GetByResourceGroup. */ +/** + * Samples for SqlManagedInstances GetByResourceGroup. + */ public final class SqlManagedInstancesGetByResourceGroupSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/GetSqlManagedInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetSqlManagedInstance.json */ /** * Sample code: Updates a SQL Instance tags. - * + * * @param manager Entry point to AzureArcDataManager. */ public static void updatesASQLInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager - .sqlManagedInstances() + manager.sqlManagedInstances() .getByResourceGroupWithResponse("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesListByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesListByResourceGroupSamples.java index 0d4e6204f225..76b3a006a482 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesListByResourceGroupSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesListByResourceGroupSamples.java @@ -4,18 +4,22 @@ package com.azure.resourcemanager.azurearcdata.generated; -/** Samples for SqlManagedInstances ListByResourceGroup. */ +/** + * Samples for SqlManagedInstances ListByResourceGroup. + */ public final class SqlManagedInstancesListByResourceGroupSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ListByResourceGroupSqlManagedInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListByResourceGroupSqlManagedInstance.json */ /** * Sample code: Gets all SQL Instance in a resource group. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void getsAllSQLInstanceInAResourceGroup( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + public static void + getsAllSQLInstanceInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { manager.sqlManagedInstances().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesListSamples.java index 611d295413a4..fdf16dc507b7 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesListSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesListSamples.java @@ -4,18 +4,22 @@ package com.azure.resourcemanager.azurearcdata.generated; -/** Samples for SqlManagedInstances List. */ +/** + * Samples for SqlManagedInstances List. + */ public final class SqlManagedInstancesListSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ListSubscriptionSqlManagedInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListSubscriptionSqlManagedInstance.json */ /** * Sample code: Gets all SQL Instance in a subscription. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void getsAllSQLInstanceInASubscription( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + public static void + getsAllSQLInstanceInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { manager.sqlManagedInstances().list(com.azure.core.util.Context.NONE); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesUpdateSamples.java index 5a6c1348841c..7637b8eab5b5 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesUpdateSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesUpdateSamples.java @@ -8,25 +8,28 @@ import java.util.HashMap; import java.util.Map; -/** Samples for SqlManagedInstances Update. */ +/** + * Samples for SqlManagedInstances Update. + */ public final class SqlManagedInstancesUpdateSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/UpdateSqlManagedInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * UpdateSqlManagedInstance.json */ /** * Sample code: Updates a sql Instance tags. - * + * * @param manager Entry point to AzureArcDataManager. */ public static void updatesASqlInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - SqlManagedInstance resource = - manager - .sqlManagedInstances() - .getByResourceGroupWithResponse("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE) - .getValue(); + SqlManagedInstance resource = manager.sqlManagedInstances() + .getByResourceGroupWithResponse("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE) + .getValue(); resource.update().withTags(mapOf("mytag", "myval")).apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsAddDatabasesSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsAddDatabasesSamples.java new file mode 100644 index 000000000000..551bd29ed371 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsAddDatabasesSamples.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.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.Databases; +import java.util.Arrays; + +/** + * Samples for SqlServerAvailabilityGroups AddDatabases. + */ +public final class SqlServerAvailabilityGroupsAddDatabasesSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * AddDatabasesToAvailabilityGroup.json + */ + /** + * Sample code: add databases to this availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + addDatabasesToThisAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .addDatabasesWithResponse("testrg", "testSqlServer_INST1", "testAG", + new Databases().withValues(Arrays.asList("db1", "db2", "db3")), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateAvailabilityGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateAvailabilityGroupSamples.java new file mode 100644 index 000000000000..32ba6aa700b6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateAvailabilityGroupSamples.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AutomatedBackupPreference; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateReplicaConfiguration; +import com.azure.resourcemanager.azurearcdata.models.ClusterType; +import com.azure.resourcemanager.azurearcdata.models.DbFailover; +import com.azure.resourcemanager.azurearcdata.models.DtcSupport; +import com.azure.resourcemanager.azurearcdata.models.FailureConditionLevel; +import com.azure.resourcemanager.azurearcdata.models.PrimaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupStaticIpListenerProperties; +import java.util.Arrays; + +/** + * Samples for SqlServerAvailabilityGroups CreateAvailabilityGroup. + */ +public final class SqlServerAvailabilityGroupsCreateAvailabilityGroupSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Create an availability group using this server for the primary replica. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createAnAvailabilityGroupUsingThisServerForThePrimaryReplica( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .createAvailabilityGroup("testrg", "testSqlServer_INST1", new AvailabilityGroupCreateUpdateConfiguration() + .withAvailabilityGroupName("myNewAg") + .withReplicas(Arrays.asList(new AvailabilityGroupCreateUpdateReplicaConfiguration().withServerInstance( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST1/") + .withEndpointName("inst1DBMEndpoint") + .withEndpointUrl("TCP://testSqlServer_INST1.testSqlserverDomain:5022") + .withEndpointConnectLogin("NT Server\\MSSSQLSERVER") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withBackupPriority(50) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.ALL) + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.ALL) + .withSessionTimeout(10), + new AvailabilityGroupCreateUpdateReplicaConfiguration().withServerInstance( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST2/") + .withEndpointName("inst2DBMEndpoint") + .withEndpointUrl("TCP://testSqlServer_INST2.testSqlserverDomain:5022") + .withEndpointConnectLogin("NT Server\\MSSSQLSERVER") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withBackupPriority(50) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.ALL) + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.ALL) + .withSessionTimeout(10))) + .withDatabases(Arrays.asList("database1", "database2")) + .withAutomatedBackupPreference(AutomatedBackupPreference.SECONDARY) + .withFailureConditionLevel(FailureConditionLevel.THREE) + .withHealthCheckTimeout(30000) + .withDbFailover(DbFailover.ON) + .withDtcSupport(DtcSupport.NONE) + .withRequiredSynchronizedSecondariesToCommit(0) + .withClusterType(ClusterType.WSFC) + .withListener(new SqlAvailabilityGroupStaticIpListenerProperties().withDnsName("myNewAgListener") + .withIpV4AddressesAndMasks(Arrays.asList( + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("192.1.168.5") + .withMask("255.255.255.0"), + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("10.1.168.5") + .withMask("255.255.255.0"))) + .withPort(1433)), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateDistributedAvailabilityGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateDistributedAvailabilityGroupSamples.java new file mode 100644 index 000000000000..ad13769795ec --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateDistributedAvailabilityGroupSamples.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.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; + +/** + * Samples for SqlServerAvailabilityGroups CreateDistributedAvailabilityGroup. + */ +public final class SqlServerAvailabilityGroupsCreateDistributedAvailabilityGroupSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateSqlServerDistributedAvailabilityGroup.json + */ + /** + * Sample code: Create a distributed availability group using this server for the primary replica. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createADistributedAvailabilityGroupUsingThisServerForThePrimaryReplica( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .createDistributedAvailabilityGroup("testrg", "testSqlServer_INST1", + new DistributedAvailabilityGroupCreateUpdateConfiguration().withAvailabilityGroupName("myNewDag") + .withPrimaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST1/availabilityGroups/testAG1") + .withListenerUrl("TCP://testAG1.contoso.com:5022") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("myCert"))) + .withSecondaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST2/availabilityGroups/testAG2") + .withListenerUrl("TCP://testAG2.contoso.com:5022") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("myCert"))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateSamples.java new file mode 100644 index 000000000000..a85d6dc7f800 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateSamples.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.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupConfigure; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupInfo; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesDatabases; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesReplicas; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerAvailabilityGroups Create. + */ +public final class SqlServerAvailabilityGroupsCreateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Create a Arc Sql Server availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + createAArcSqlServerAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .define("testAG") + .withRegion("southeastasia") + .withExistingSqlServerInstance("testrg", "testSqlServer_INST1") + .withProperties( + new SqlServerAvailabilityGroupResourceProperties() + .withInfo(new AvailabilityGroupInfo().withFailureConditionLevel(3) + .withHealthCheckTimeout(30000) + .withBasicFeatures(false) + .withDtcSupport(false) + .withDbFailover(true) + .withIsDistributed(false) + .withRequiredSynchronizedSecondariesToCommit(0) + .withIsContained(false)) + .withReplicas( + new SqlServerAvailabilityGroupResourcePropertiesReplicas().withValue(Arrays.asList( + new SqlAvailabilityGroupReplicaResourceProperties().withReplicaName("testSqlServer\\INST1") + .withConfigure(new AvailabilityGroupConfigure() + .withEndpointUrl("TCP://mytest60-0.mytest60-svc:5022") + .withSessionTimeout(10) + .withBackupPriority(50))))) + .withDatabases(new SqlServerAvailabilityGroupResourcePropertiesDatabases().withValue(Arrays.asList( + new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("db1"), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("db2"))))) + .withTags(mapOf("mytag", "myval")) + .create(); + } + + // Use "Map.of" if available + @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/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDeleteSamples.java new file mode 100644 index 000000000000..9430961ed379 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerAvailabilityGroups Delete. + */ +public final class SqlServerAvailabilityGroupsDeleteSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Deletes a availability group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + deletesAAvailabilityGroupResource(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .delete("testrg", "testsqlInstanceAvailabilityGroup", "testAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDetailViewSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDetailViewSamples.java new file mode 100644 index 000000000000..33e0639256df --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDetailViewSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerAvailabilityGroups DetailView. + */ +public final class SqlServerAvailabilityGroupsDetailViewSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ViewArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: detail view for a server availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + detailViewForAServerAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .detailViewWithResponse("testrg", "testSqlServer_INST1", "testAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsFailoverSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsFailoverSamples.java new file mode 100644 index 000000000000..68977c96c863 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsFailoverSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerAvailabilityGroups Failover. + */ +public final class SqlServerAvailabilityGroupsFailoverSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * FailoverArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: availability group manual failover to this server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void availabilityGroupManualFailoverToThisServer( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .failoverWithResponse("testrg", "testSqlServer_INST1", "testAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsForceFailoverAllowDataLossSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsForceFailoverAllowDataLossSamples.java new file mode 100644 index 000000000000..22625d971e3e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsForceFailoverAllowDataLossSamples.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.azurearcdata.generated; + +/** + * Samples for SqlServerAvailabilityGroups ForceFailoverAllowDataLoss. + */ +public final class SqlServerAvailabilityGroupsForceFailoverAllowDataLossSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ForceFailoverArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: availability group force failover to this server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + availabilityGroupForceFailoverToThisServer(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .forceFailoverAllowDataLossWithResponse("testrg", "testSqlServer_INST1", "testAG", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsGetSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsGetSamples.java new file mode 100644 index 000000000000..6e477d713666 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerAvailabilityGroups Get. + */ +public final class SqlServerAvailabilityGroupsGetSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Retrieves an Arc Sql Server availability group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesAnArcSqlServerAvailabilityGroupResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .getWithResponse("testrg", "testSqlServer_INST1", "testAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsListSamples.java new file mode 100644 index 000000000000..9c7180f11675 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsListSamples.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.azurearcdata.generated; + +/** + * Samples for SqlServerAvailabilityGroups List. + */ +public final class SqlServerAvailabilityGroupsListSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListBySqlServerInstanceAvailabilityGroup.json + */ + /** + * Sample code: Gets all availability groups associated with an Arc Enabled Sql server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllAvailabilityGroupsAssociatedWithAnArcEnabledSqlServer( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups().list("testrg", "testSqlServer_INST1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsRemoveDatabasesSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsRemoveDatabasesSamples.java new file mode 100644 index 000000000000..680743b8b33b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsRemoveDatabasesSamples.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.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.Databases; +import java.util.Arrays; + +/** + * Samples for SqlServerAvailabilityGroups RemoveDatabases. + */ +public final class SqlServerAvailabilityGroupsRemoveDatabasesSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * RemoveDatabasesFromAvailabilityGroup.json + */ + /** + * Sample code: remove databases from this availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + removeDatabasesFromThisAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .removeDatabasesWithResponse("testrg", "testSqlServer_INST1", "testAG", + new Databases().withValues(Arrays.asList("db1")), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsUpdateSamples.java new file mode 100644 index 000000000000..5bc5ac01c114 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerAvailabilityGroups Update. + */ +public final class SqlServerAvailabilityGroupsUpdateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * UpdateArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Update an availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updateAnAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerAvailabilityGroupResource resource = manager.sqlServerAvailabilityGroups() + .getWithResponse("testrg", "testSqlServer_INST1", "testAG", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval1")).apply(); + } + + // Use "Map.of" if available + @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/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesCreateSamples.java new file mode 100644 index 000000000000..eea0f0fa770d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesCreateSamples.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.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.BackupPolicy; +import com.azure.resourcemanager.azurearcdata.models.DatabaseCreateMode; +import com.azure.resourcemanager.azurearcdata.models.DatabaseState; +import com.azure.resourcemanager.azurearcdata.models.DifferentialBackupHours; +import com.azure.resourcemanager.azurearcdata.models.RecoveryMode; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesBackupInformation; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesDatabaseOptions; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerDatabases Create. + */ +public final class SqlServerDatabasesCreateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateArcSqlServerDatabase.json + */ + /** + * Sample code: Create a Arc Sql Server database. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createAArcSqlServerDatabase(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerDatabases() + .define("testdb") + .withRegion("southeastasia") + .withExistingSqlServerInstance("testrg", "testSqlServerInstance") + .withProperties(new SqlServerDatabaseResourceProperties().withCollationName("SQL_Latin1_General_CP1_CI_AS") + .withDatabaseCreationDate(OffsetDateTime.parse("2022-04-05T16:26:33.883Z")) + .withCompatibilityLevel(150) + .withSizeMB(150.0F) + .withSpaceAvailableMB(100.0F) + .withState(DatabaseState.ONLINE) + .withIsReadOnly(true) + .withRecoveryMode(RecoveryMode.FULL) + .withDatabaseOptions(new SqlServerDatabaseResourcePropertiesDatabaseOptions().withIsAutoCloseOn(true) + .withIsAutoShrinkOn(true) + .withIsAutoCreateStatsOn(true) + .withIsAutoUpdateStatsOn(true) + .withIsRemoteDataArchiveEnabled(true) + .withIsMemoryOptimizationEnabled(true) + .withIsEncrypted(true) + .withIsTrustworthyOn(true)) + .withBackupInformation(new SqlServerDatabaseResourcePropertiesBackupInformation() + .withLastFullBackup(OffsetDateTime.parse("2022-05-05T16:26:33.883Z")) + .withLastLogBackup(OffsetDateTime.parse("2022-05-10T16:26:33.883Z"))) + .withBackupPolicy(new BackupPolicy().withRetentionPeriodDays(1) + .withFullBackupDays(1) + .withDifferentialBackupHours(DifferentialBackupHours.ONE_TWO) + .withTransactionLogBackupMinutes(30)) + .withCreateMode(DatabaseCreateMode.POINT_IN_TIME_RESTORE) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/testSqlServerInstance/testsqlManagedInstance/databases/MyDatabase") + .withRestorePointInTime(OffsetDateTime.parse("2022-05-05T16:26:33.883Z"))) + .withTags(mapOf("mytag", "myval")) + .create(); + } + + // Use "Map.of" if available + @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/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesDeleteSamples.java new file mode 100644 index 000000000000..68f0bd993199 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesDeleteSamples.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.azurearcdata.generated; + +/** + * Samples for SqlServerDatabases Delete. + */ +public final class SqlServerDatabasesDeleteSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteArcSqlServerDatabase.json + */ + /** + * Sample code: Deletes a database resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deletesADatabaseResource(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerDatabases() + .delete("testrg", "testsqlManagedInstance", "testdb", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesGetSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesGetSamples.java new file mode 100644 index 000000000000..4a55ab705c37 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerDatabases Get. + */ +public final class SqlServerDatabasesGetSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetArcSqlServerDatabase.json + */ + /** + * Sample code: Retrieves an Arc Sql Server database resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + retrievesAnArcSqlServerDatabaseResource(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerDatabases() + .getWithResponse("testrg", "testSqlServerInstance", "testdb", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesListSamples.java new file mode 100644 index 000000000000..7a455c79f829 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesListSamples.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.azurearcdata.generated; + +/** + * Samples for SqlServerDatabases List. + */ +public final class SqlServerDatabasesListSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListBySqlServerInstanceDatabase.json + */ + /** + * Sample code: Gets all databases associated with an Arc Enabled Sql server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllDatabasesAssociatedWithAnArcEnabledSqlServer( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerDatabases().list("testrg", "testSqlServerInstance", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesUpdateSamples.java new file mode 100644 index 000000000000..a4a0e58b158e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerDatabases Update. + */ +public final class SqlServerDatabasesUpdateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * UpdateSqlServerDatabase.json + */ + /** + * Sample code: Update a database. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updateADatabase(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerDatabaseResource resource = manager.sqlServerDatabases() + .getWithResponse("testrg", "testsqlManagedInstance", "testdb", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval1")).apply(); + } + + // Use "Map.of" if available + @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/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesCreateSamples.java new file mode 100644 index 000000000000..f8d358ae62b5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesCreateSamples.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.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseProperties; +import com.azure.resourcemanager.azurearcdata.models.State; +import com.azure.resourcemanager.azurearcdata.models.Version; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerEsuLicenses Create. + */ +public final class SqlServerEsuLicensesCreateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateSqlServerEsuLicense.json + */ + /** + * Sample code: Updates a SQL Server ESU license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updatesASQLServerESULicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses() + .define("testsqlServerEsuLicense") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withProperties(new SqlServerEsuLicenseProperties().withBillingPlan(BillingPlan.PAYG) + .withVersion(Version.SQL_SERVER_2012) + .withPhysicalCores(24) + .withActivationState(State.INACTIVE) + .withScopeType(ScopeType.SUBSCRIPTION)) + .withTags(mapOf("mytag", "myval")) + .create(); + } + + // Use "Map.of" if available + @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/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesDeleteSamples.java new file mode 100644 index 000000000000..4ba23d9631e1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesDeleteSamples.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.azurearcdata.generated; + +/** + * Samples for SqlServerEsuLicenses Delete. + */ +public final class SqlServerEsuLicensesDeleteSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteSqlServerEsuLicense.json + */ + /** + * Sample code: Delete a SQL Server ESU license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deleteASQLServerESULicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses() + .deleteByResourceGroupWithResponse("testrg", "testsqlServerEsuLicense", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesGetByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..97c8c9219bc0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesGetByResourceGroupSamples.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.azurearcdata.generated; + +/** + * Samples for SqlServerEsuLicenses GetByResourceGroup. + */ +public final class SqlServerEsuLicensesGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetSqlServerEsuLicense.json + */ + /** + * Sample code: Gets a SQL Server ESU license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsASQLServerESULicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses() + .getByResourceGroupWithResponse("testrg", "testsqlServerEsuLicense", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListByResourceGroupSamples.java new file mode 100644 index 000000000000..96022e8cf940 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListByResourceGroupSamples.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.azurearcdata.generated; + +/** + * Samples for SqlServerEsuLicenses ListByResourceGroup. + */ +public final class SqlServerEsuLicensesListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListByResourceGroupSqlServerEsuLicense.json + */ + /** + * Sample code: Gets all SQL Server ESU licenses in a resource group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllSQLServerESULicensesInAResourceGroup( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListSamples.java new file mode 100644 index 000000000000..aa17f15a9ac4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListSamples.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.azurearcdata.generated; + +/** + * Samples for SqlServerEsuLicenses List. + */ +public final class SqlServerEsuLicensesListSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListSubscriptionSqlServerEsuLicense.json + */ + /** + * Sample code: Gets all SQL Server ESU licenses in a subscription. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllSQLServerESULicensesInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesUpdateSamples.java new file mode 100644 index 000000000000..0e3267f865b1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesUpdateSamples.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.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicense; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdateProperties; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerEsuLicenses Update. + */ +public final class SqlServerEsuLicensesUpdateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * UpdateSqlServerEsuLicense.json + */ + /** + * Sample code: Patch a SQL Server ESU license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void patchASQLServerESULicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerEsuLicense resource = manager.sqlServerEsuLicenses() + .getByResourceGroupWithResponse("testrg", "testsqlServerEsuLicense", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("mytag", "myval")) + .withProperties(new SqlServerEsuLicenseUpdateProperties().withBillingPlan(BillingPlan.PAID) + .withPhysicalCores(28) + .withActivationState(State.ACTIVE)) + .apply(); + } + + // Use "Map.of" if available + @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/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesCreateSamples.java index c00d97d070a8..33dfca9653b3 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesCreateSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesCreateSamples.java @@ -4,54 +4,58 @@ package com.azure.resourcemanager.azurearcdata.generated; -import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType; -import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus; -import com.azure.resourcemanager.azurearcdata.models.DefenderStatus; +import com.azure.resourcemanager.azurearcdata.models.BackupPolicy; +import com.azure.resourcemanager.azurearcdata.models.ClientConnection; +import com.azure.resourcemanager.azurearcdata.models.DifferentialBackupHours; import com.azure.resourcemanager.azurearcdata.models.EditionType; +import com.azure.resourcemanager.azurearcdata.models.HostType; +import com.azure.resourcemanager.azurearcdata.models.Migration; +import com.azure.resourcemanager.azurearcdata.models.MigrationAssessment; +import com.azure.resourcemanager.azurearcdata.models.Monitoring; +import com.azure.resourcemanager.azurearcdata.models.ServiceType; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties; import com.azure.resourcemanager.azurearcdata.models.SqlVersion; -import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; -/** Samples for SqlServerInstances Create. */ +/** + * Samples for SqlServerInstances Create. + */ public final class SqlServerInstancesCreateSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/CreateOrUpdateSqlServerInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void updatesASQLServerInstanceTags( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager - .sqlServerInstances() + public static void + updatesASQLServerInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() .define("testsqlServerInstance") .withRegion("northeurope") .withExistingResourceGroup("testrg") .withTags(mapOf("mytag", "myval")) - .withProperties( - new SqlServerInstanceProperties() - .withVersion(SqlVersion.SQL_SERVER_2017) - .withEdition(EditionType.DEVELOPER) - .withContainerResourceId("Arc Machine Name") - .withVCore("4") - .withStatus(ConnectionStatus.CONNECTED) - .withPatchLevel("patchlevel") - .withCollation("collation") - .withCurrentVersion("2008 R2") - .withInstanceName("name of instance") - .withTcpDynamicPorts("1433") - .withTcpStaticPorts("1433") - .withProductId("sql id") - .withLicenseType(ArcSqlServerLicenseType.FREE) - .withAzureDefenderStatusLastUpdated(OffsetDateTime.parse("2020-01-02T17:18:19.1234567Z")) - .withAzureDefenderStatus(DefenderStatus.PROTECTED)) + .withProperties(new SqlServerInstanceProperties().withVersion(SqlVersion.SQL_SERVER_2012) + .withEdition(EditionType.DEVELOPER) + .withCores("4") + .withInstanceName("name of instance") + .withHostType(HostType.PHYSICAL_SERVER) + .withBackupPolicy(new BackupPolicy().withRetentionPeriodDays(1) + .withFullBackupDays(1) + .withDifferentialBackupHours(DifferentialBackupHours.ONE_TWO) + .withTransactionLogBackupMinutes(30)) + .withMonitoring(new Monitoring().withEnabled(false)) + .withMigration(new Migration().withAssessment(new MigrationAssessment().withEnabled(false))) + .withClientConnection(new ClientConnection().withEnabled(false)) + .withServiceType(ServiceType.ENGINE)) .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesDeleteSamples.java index f7ef374908b0..496005ed09a3 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesDeleteSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesDeleteSamples.java @@ -4,14 +4,18 @@ package com.azure.resourcemanager.azurearcdata.generated; -/** Samples for SqlServerInstances Delete. */ +/** + * Samples for SqlServerInstances Delete. + */ public final class SqlServerInstancesDeleteSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/DeleteSqlServerInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteSqlServerInstance.json */ /** * Sample code: Delete a SQL Server Instance. - * + * * @param manager Entry point to AzureArcDataManager. */ public static void deleteASQLServerInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetByResourceGroupSamples.java index bffdbb2242ac..4b4b52b61980 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetByResourceGroupSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetByResourceGroupSamples.java @@ -4,20 +4,23 @@ package com.azure.resourcemanager.azurearcdata.generated; -/** Samples for SqlServerInstances GetByResourceGroup. */ +/** + * Samples for SqlServerInstances GetByResourceGroup. + */ public final class SqlServerInstancesGetByResourceGroupSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/GetSqlServerInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void updatesASQLServerInstanceTags( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager - .sqlServerInstances() + public static void + updatesASQLServerInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() .getByResourceGroupWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetJobsStatusSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetJobsStatusSamples.java new file mode 100644 index 000000000000..558fbe37373a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetJobsStatusSamples.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.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusRequest; + +/** + * Samples for SqlServerInstances GetJobsStatus. + */ +public final class SqlServerInstancesGetJobsStatusSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetSqlServerInstanceJobsStatus.json + */ + /** + * Sample code: Retrieves Arc SQL Server instance jobs status. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + retrievesArcSQLServerInstanceJobsStatus(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getJobsStatusWithResponse("testrg", "testsqlserver", + new SqlServerInstanceJobsStatusRequest().withFeatureName("MigrationAssessment").withJobType("Ondemand"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetTelemetrySamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetTelemetrySamples.java new file mode 100644 index 000000000000..677d7b6291f2 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetTelemetrySamples.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.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryRequest; +import java.time.OffsetDateTime; + +/** + * Samples for SqlServerInstances GetTelemetry. + */ +public final class SqlServerInstancesGetTelemetrySamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetSqlServerInstanceTelemetry.json + */ + /** + * Sample code: Retrieves Arc SQL Server cpu utilization telemetry. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesArcSQLServerCpuUtilizationTelemetry( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getTelemetry("testrg", "testsqlserver", + new SqlServerInstanceTelemetryRequest().withDatasetName("sqlserver_storage_io") + .withStartTime(OffsetDateTime.parse("2023-09-30T00:00:00Z")), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListByResourceGroupSamples.java index 85ca68ba5fea..737893e9785c 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListByResourceGroupSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListByResourceGroupSamples.java @@ -4,18 +4,22 @@ package com.azure.resourcemanager.azurearcdata.generated; -/** Samples for SqlServerInstances ListByResourceGroup. */ +/** + * Samples for SqlServerInstances ListByResourceGroup. + */ public final class SqlServerInstancesListByResourceGroupSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ListByResourceGroupSqlServerInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListByResourceGroupSqlServerInstance.json */ /** * Sample code: Gets all SQL Server Instance in a resource group. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void getsAllSQLServerInstanceInAResourceGroup( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + public static void + getsAllSQLServerInstanceInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { manager.sqlServerInstances().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListSamples.java index cdcf3e109150..729f5b2a8f93 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListSamples.java @@ -4,18 +4,22 @@ package com.azure.resourcemanager.azurearcdata.generated; -/** Samples for SqlServerInstances List. */ +/** + * Samples for SqlServerInstances List. + */ public final class SqlServerInstancesListSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ListSubscriptionSqlServerInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListSubscriptionSqlServerInstance.json */ /** * Sample code: Gets all SQL Server Instance in a subscription. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void getsAllSQLServerInstanceInASubscription( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + public static void + getsAllSQLServerInstanceInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { manager.sqlServerInstances().list(com.azure.core.util.Context.NONE); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesPostUpgradeSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesPostUpgradeSamples.java new file mode 100644 index 000000000000..8d3c185c2a39 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesPostUpgradeSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerInstances PostUpgrade. + */ +public final class SqlServerInstancesPostUpgradeSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * PostUpgradeSqlServerInstance.json + */ + /** + * Sample code: Post AUM Upgrade to complete SQL Instance Upgrade Process. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void postAUMUpgradeToCompleteSQLInstanceUpgradeProcess( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .postUpgradeWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesPreUpgradeSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesPreUpgradeSamples.java new file mode 100644 index 000000000000..60aaa3616d42 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesPreUpgradeSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerInstances PreUpgrade. + */ +public final class SqlServerInstancesPreUpgradeSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * PreUpgradeSqlServerInstance.json + */ + /** + * Sample code: Prepare SQL server instance for AUM Upgrade. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + prepareSQLServerInstanceForAUMUpgrade(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .preUpgradeWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunMigrationAssessmentSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunMigrationAssessmentSamples.java new file mode 100644 index 000000000000..d17cd43380d7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunMigrationAssessmentSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerInstances RunMigrationAssessment. + */ +public final class SqlServerInstancesRunMigrationAssessmentSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * RunMigrationAssessmentSqlServerInstance.json + */ + /** + * Sample code: Trigger migration assessment run on sql server instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void triggerMigrationAssessmentRunOnSqlServerInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .runMigrationAssessmentWithResponse("testrg", "testsqlserver", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesUpdateSamples.java index 7f49db862098..48f491018782 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesUpdateSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesUpdateSamples.java @@ -8,26 +8,29 @@ import java.util.HashMap; import java.util.Map; -/** Samples for SqlServerInstances Update. */ +/** + * Samples for SqlServerInstances Update. + */ public final class SqlServerInstancesUpdateSamples { /* - * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/UpdateSqlServerInstance.json + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * UpdateSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. - * + * * @param manager Entry point to AzureArcDataManager. */ - public static void updatesASQLServerInstanceTags( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - SqlServerInstance resource = - manager - .sqlServerInstances() - .getByResourceGroupWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE) - .getValue(); + public static void + updatesASQLServerInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerInstance resource = manager.sqlServerInstances() + .getByResourceGroupWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE) + .getValue(); resource.update().withTags(mapOf("mytag", "myval")).apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesCreateSamples.java new file mode 100644 index 000000000000..39d3b60db7ae --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesCreateSamples.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.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.ActivationState; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.LicenseCategory; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerLicenses Create. + */ +public final class SqlServerLicensesCreateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * CreateOrUpdateSqlServerLicense.json + */ + /** + * Sample code: Updates a SQL Server license tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + updatesASQLServerLicenseTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses() + .define("testsqlServerLicense") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withProperties(new SqlServerLicenseProperties().withBillingPlan(BillingPlan.PAYG) + .withPhysicalCores(24) + .withLicenseCategory(LicenseCategory.CORE) + .withActivationState(ActivationState.DEACTIVATED) + .withScopeType(ScopeType.SUBSCRIPTION)) + .withTags(mapOf("mytag", "myval")) + .create(); + } + + // Use "Map.of" if available + @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/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesDeleteSamples.java new file mode 100644 index 000000000000..f8309f7c364e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesDeleteSamples.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.azurearcdata.generated; + +/** + * Samples for SqlServerLicenses Delete. + */ +public final class SqlServerLicensesDeleteSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * DeleteSqlServerLicense.json + */ + /** + * Sample code: Delete a SQL Server license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deleteASQLServerLicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses() + .deleteByResourceGroupWithResponse("testrg", "testsqlServerLicense", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesGetByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..bb419c5391d0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesGetByResourceGroupSamples.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.azurearcdata.generated; + +/** + * Samples for SqlServerLicenses GetByResourceGroup. + */ +public final class SqlServerLicensesGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * GetSqlServerLicense.json + */ + /** + * Sample code: Gets a SQL Server license tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsASQLServerLicenseTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses() + .getByResourceGroupWithResponse("testrg", "testsqlServerLicense", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListByResourceGroupSamples.java new file mode 100644 index 000000000000..194d274e3a3e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListByResourceGroupSamples.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.azurearcdata.generated; + +/** + * Samples for SqlServerLicenses ListByResourceGroup. + */ +public final class SqlServerLicensesListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListByResourceGroupSqlServerLicense.json + */ + /** + * Sample code: Gets all SQL Server license in a resource group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllSQLServerLicenseInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListSamples.java new file mode 100644 index 000000000000..3a7c4ad766d5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListSamples.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.azurearcdata.generated; + +/** + * Samples for SqlServerLicenses List. + */ +public final class SqlServerLicensesListSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * ListSubscriptionSqlServerLicense.json + */ + /** + * Sample code: Gets all SQL Server license in a subscription. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllSQLServerLicenseInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesUpdateSamples.java new file mode 100644 index 000000000000..2c691f26295c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicense; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerLicenses Update. + */ +public final class SqlServerLicensesUpdateSamples { + /* + * x-ms-original-file: + * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2024-05-01-preview/examples/ + * UpdateSqlServerLicense.json + */ + /** + * Sample code: Patch a SQL Server license tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void patchASQLServerLicenseTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerLicense resource = manager.sqlServerLicenses() + .getByResourceGroupWithResponse("testrg", "testsqlServerLicense", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval")).apply(); + } + + // Use "Map.of" if available + @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/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DataControllerUpdateTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DataControllerUpdateTests.java deleted file mode 100644 index d738d771be16..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DataControllerUpdateTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.DataControllerUpdate; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class DataControllerUpdateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DataControllerUpdate model = - BinaryData - .fromString( - "{\"tags\":{\"dzumveekg\":\"skzbb\",\"bsjyofdx\":\"wozuhkf\",\"oekqvk\":\"uusdttouwa\",\"vbxwyjsflhh\":\"lns\"}}") - .toObject(DataControllerUpdate.class); - Assertions.assertEquals("skzbb", model.tags().get("dzumveekg")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DataControllerUpdate model = - new DataControllerUpdate() - .withTags( - mapOf("dzumveekg", "skzbb", "bsjyofdx", "wozuhkf", "oekqvk", "uusdttouwa", "vbxwyjsflhh", "lns")); - model = BinaryData.fromObject(model).toObject(DataControllerUpdate.class); - Assertions.assertEquals("skzbb", model.tags().get("dzumveekg")); - } - - @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/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersDeleteMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersDeleteMockTests.java deleted file mode 100644 index 2047797e15fb..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersDeleteMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class DataControllersDeleteMockTests { - @Test - public void testDelete() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - AzureArcDataManager manager = - AzureArcDataManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.dataControllers().delete("xrtfudxep", "gyqagvrvmnpkuk", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ExtendedLocationTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ExtendedLocationTests.java deleted file mode 100644 index 5fe85115474f..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ExtendedLocationTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; -import com.azure.resourcemanager.azurearcdata.models.ExtendedLocationTypes; -import org.junit.jupiter.api.Assertions; - -public final class ExtendedLocationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExtendedLocation model = - BinaryData - .fromString("{\"name\":\"qzbqjvsov\",\"type\":\"CustomLocation\"}") - .toObject(ExtendedLocation.class); - Assertions.assertEquals("qzbqjvsov", model.name()); - Assertions.assertEquals(ExtendedLocationTypes.CUSTOM_LOCATION, model.type()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExtendedLocation model = - new ExtendedLocation().withName("qzbqjvsov").withType(ExtendedLocationTypes.CUSTOM_LOCATION); - model = BinaryData.fromObject(model).toObject(ExtendedLocation.class); - Assertions.assertEquals("qzbqjvsov", model.name()); - Assertions.assertEquals(ExtendedLocationTypes.CUSTOM_LOCATION, model.type()); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SResourceRequirementsTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SResourceRequirementsTests.java deleted file mode 100644 index 0fac85615c1d..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SResourceRequirementsTests.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.K8SResourceRequirements; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class K8SResourceRequirementsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - K8SResourceRequirements model = - BinaryData - .fromString( - "{\"requests\":{\"pjmcmatuokthfuiu\":\"eupfhyhltrpm\"},\"limits\":{\"zydagfuaxbezyiuo\":\"sfcpkvxodpuozm\",\"dxwzywqsmbsurexi\":\"ktwh\",\"yocf\":\"o\",\"uxh\":\"fksymddystki\"},\"\":{\"i\":\"datadxorrqnbpoczv\",\"sllr\":\"dataqrvkdv\"}}") - .toObject(K8SResourceRequirements.class); - Assertions.assertEquals("eupfhyhltrpm", model.requests().get("pjmcmatuokthfuiu")); - Assertions.assertEquals("sfcpkvxodpuozm", model.limits().get("zydagfuaxbezyiuo")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - K8SResourceRequirements model = - new K8SResourceRequirements() - .withRequests(mapOf("pjmcmatuokthfuiu", "eupfhyhltrpm")) - .withLimits( - mapOf( - "zydagfuaxbezyiuo", - "sfcpkvxodpuozm", - "dxwzywqsmbsurexi", - "ktwh", - "yocf", - "o", - "uxh", - "fksymddystki")) - .withAdditionalProperties(mapOf()); - model = BinaryData.fromObject(model).toObject(K8SResourceRequirements.class); - Assertions.assertEquals("eupfhyhltrpm", model.requests().get("pjmcmatuokthfuiu")); - Assertions.assertEquals("sfcpkvxodpuozm", model.limits().get("zydagfuaxbezyiuo")); - } - - @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/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSchedulingOptionsTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSchedulingOptionsTests.java deleted file mode 100644 index ddcb494b499e..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSchedulingOptionsTests.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.K8SResourceRequirements; -import com.azure.resourcemanager.azurearcdata.models.K8SSchedulingOptions; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class K8SSchedulingOptionsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - K8SSchedulingOptions model = - BinaryData - .fromString( - "{\"resources\":{\"requests\":{\"suesnzw\":\"adehxnltyfsopp\",\"avo\":\"ej\",\"vudwx\":\"xzdmohctb\",\"gujjugwdkcglh\":\"ndnvo\"},\"limits\":{\"yggdtjixh\":\"zj\",\"evfyexfwhybcib\":\"kuofqweykhme\"},\"\":{\"ynnaam\":\"datadcsi\",\"qsc\":\"dataectehf\",\"hcjrefovgmk\":\"dataeypvhezrkg\"}},\"\":{\"pngjcrcczsqpjhvm\":\"dataeyyvxyqjpkcat\",\"a\":\"dataajvnysounqe\"}}") - .toObject(K8SSchedulingOptions.class); - Assertions.assertEquals("adehxnltyfsopp", model.resources().requests().get("suesnzw")); - Assertions.assertEquals("zj", model.resources().limits().get("yggdtjixh")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - K8SSchedulingOptions model = - new K8SSchedulingOptions() - .withResources( - new K8SResourceRequirements() - .withRequests( - mapOf( - "suesnzw", - "adehxnltyfsopp", - "avo", - "ej", - "vudwx", - "xzdmohctb", - "gujjugwdkcglh", - "ndnvo")) - .withLimits(mapOf("yggdtjixh", "zj", "evfyexfwhybcib", "kuofqweykhme")) - .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf()); - model = BinaryData.fromObject(model).toObject(K8SSchedulingOptions.class); - Assertions.assertEquals("adehxnltyfsopp", model.resources().requests().get("suesnzw")); - Assertions.assertEquals("zj", model.resources().limits().get("yggdtjixh")); - } - - @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/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSchedulingTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSchedulingTests.java deleted file mode 100644 index 2832ad7d1d75..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSchedulingTests.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.K8SResourceRequirements; -import com.azure.resourcemanager.azurearcdata.models.K8SScheduling; -import com.azure.resourcemanager.azurearcdata.models.K8SSchedulingOptions; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class K8SSchedulingTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - K8SScheduling model = - BinaryData - .fromString( - "{\"default\":{\"resources\":{\"requests\":{\"qjqabcypmivkwl\":\"zevgb\",\"wnfnbacf\":\"uvcc\",\"bqqwxrj\":\"onlebxetqgtzxdpn\"},\"limits\":{\"njampm\":\"llnwsubi\"},\"\":{\"chcbonqvpkvlrxnj\":\"datazscxaqwo\",\"pheoflokeyy\":\"dataase\"}},\"\":{\"asxazjpqyegualhb\":\"datajbdlwtgrhpdjpju\"}},\"\":{\"jzzvdud\":\"datae\",\"pwlbjnpg\":\"datawdslfhotwmcy\"}}") - .toObject(K8SScheduling.class); - Assertions.assertEquals("zevgb", model.defaultProperty().resources().requests().get("qjqabcypmivkwl")); - Assertions.assertEquals("llnwsubi", model.defaultProperty().resources().limits().get("njampm")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - K8SScheduling model = - new K8SScheduling() - .withDefaultProperty( - new K8SSchedulingOptions() - .withResources( - new K8SResourceRequirements() - .withRequests( - mapOf("qjqabcypmivkwl", "zevgb", "wnfnbacf", "uvcc", "bqqwxrj", "onlebxetqgtzxdpn")) - .withLimits(mapOf("njampm", "llnwsubi")) - .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf()); - model = BinaryData.fromObject(model).toObject(K8SScheduling.class); - Assertions.assertEquals("zevgb", model.defaultProperty().resources().requests().get("qjqabcypmivkwl")); - Assertions.assertEquals("llnwsubi", model.defaultProperty().resources().limits().get("njampm")); - } - - @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/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationDisplayTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationDisplayTests.java deleted file mode 100644 index fa1f9edd3501..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationDisplayTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; - -public final class OperationDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationDisplay model = - BinaryData - .fromString( - "{\"provider\":\"iodjp\",\"resource\":\"lwejdpv\",\"operation\":\"ryo\",\"description\":\"psoacctazakljl\"}") - .toObject(OperationDisplay.class); - Assertions.assertEquals("iodjp", model.provider()); - Assertions.assertEquals("lwejdpv", model.resource()); - Assertions.assertEquals("ryo", model.operation()); - Assertions.assertEquals("psoacctazakljl", model.description()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationDisplay model = - new OperationDisplay() - .withProvider("iodjp") - .withResource("lwejdpv") - .withOperation("ryo") - .withDescription("psoacctazakljl"); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - Assertions.assertEquals("iodjp", model.provider()); - Assertions.assertEquals("lwejdpv", model.resource()); - Assertions.assertEquals("ryo", model.operation()); - Assertions.assertEquals("psoacctazakljl", model.description()); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationInnerTests.java deleted file mode 100644 index 4b59d10acfeb..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationInnerTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.fluent.models.OperationInner; -import com.azure.resourcemanager.azurearcdata.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; - -public final class OperationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationInner model = - BinaryData - .fromString( - "{\"name\":\"lokjyemkk\",\"display\":{\"provider\":\"ni\",\"resource\":\"joxzjnchgejspodm\",\"operation\":\"ilzyd\",\"description\":\"h\"},\"origin\":\"system\",\"isDataAction\":false,\"properties\":{\"ixjsprozvcputeg\":\"datauxinpmqnjaq\",\"atscmd\":\"datavwmf\",\"zkrwfn\":\"datapjhulsuuvmkj\"}}") - .toObject(OperationInner.class); - Assertions.assertEquals("lokjyemkk", model.name()); - Assertions.assertEquals("ni", model.display().provider()); - Assertions.assertEquals("joxzjnchgejspodm", model.display().resource()); - Assertions.assertEquals("ilzyd", model.display().operation()); - Assertions.assertEquals("h", model.display().description()); - Assertions.assertEquals(false, model.isDataAction()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationInner model = - new OperationInner() - .withName("lokjyemkk") - .withDisplay( - new OperationDisplay() - .withProvider("ni") - .withResource("joxzjnchgejspodm") - .withOperation("ilzyd") - .withDescription("h")) - .withIsDataAction(false); - model = BinaryData.fromObject(model).toObject(OperationInner.class); - Assertions.assertEquals("lokjyemkk", model.name()); - Assertions.assertEquals("ni", model.display().provider()); - Assertions.assertEquals("joxzjnchgejspodm", model.display().resource()); - Assertions.assertEquals("ilzyd", model.display().operation()); - Assertions.assertEquals("h", model.display().description()); - Assertions.assertEquals(false, model.isDataAction()); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationListResultTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationListResultTests.java deleted file mode 100644 index a99138f70a69..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationListResultTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.OperationListResult; - -public final class OperationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationListResult model = - BinaryData - .fromString( - "{\"value\":[{\"name\":\"hq\",\"display\":{\"provider\":\"vgjxpybczm\",\"resource\":\"hmtzopbsphrup\",\"operation\":\"dgs\",\"description\":\"bb\"},\"origin\":\"user\",\"isDataAction\":false,\"properties\":{\"xaobhdxbmtqioqjz\":\"dataycm\",\"ownoizhw\":\"datahtbmuf\",\"jgkdmbpazlobcu\":\"datarxybqsoq\",\"qgn\":\"datapdznrbtcqqjnqgl\"}},{\"name\":\"foooj\",\"display\":{\"provider\":\"wifsq\",\"resource\":\"saagdf\",\"operation\":\"glzlhjxrifkwmrv\",\"description\":\"tsizntocipaoua\"},\"origin\":\"user\",\"isDataAction\":false,\"properties\":{\"fogknygjofjdde\":\"datampoyfd\",\"deupewnwrei\":\"datas\",\"arhmofcqhsmy\":\"datajzyflu\",\"kuksjtxukcdm\":\"datarkdtmlxh\"}},{\"name\":\"arcryuanzwuxzdxt\",\"display\":{\"provider\":\"yrlhmwhfpmrqobm\",\"resource\":\"u\",\"operation\":\"knryrtihfxtij\",\"description\":\"pzvgnwzsymglzufc\"},\"origin\":\"user\",\"isDataAction\":true,\"properties\":{\"fcbjysagithxqha\":\"databihanuf\",\"cnpqxuhivyqniwby\":\"dataifpikxwczby\",\"grtfwvu\":\"datarkxvdum\",\"h\":\"dataxgaudccs\"}}],\"nextLink\":\"cnyejhkryhtnapcz\"}") - .toObject(OperationListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationListResult model = new OperationListResult(); - model = BinaryData.fromObject(model).toObject(OperationListResult.class); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationsListMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationsListMockTests.java deleted file mode 100644 index 7329235e2b92..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationsListMockTests.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; -import com.azure.resourcemanager.azurearcdata.models.Operation; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class OperationsListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"name\":\"aalnjixi\",\"display\":{\"provider\":\"xyawj\",\"resource\":\"yaqcslyjpkiidz\",\"operation\":\"exznelixhnr\",\"description\":\"tfolhbnx\"},\"origin\":\"system\",\"isDataAction\":false,\"properties\":{\"ggdtpnapnyiro\":\"datalp\",\"ylgqgitxmedjvcsl\":\"datauhpigvp\",\"wwncwzzhxgk\":\"datan\",\"t\":\"datarmgucnap\"}}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - AzureArcDataManager manager = - AzureArcDataManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); - - Assertions.assertEquals("aalnjixi", response.iterator().next().name()); - Assertions.assertEquals("xyawj", response.iterator().next().display().provider()); - Assertions.assertEquals("yaqcslyjpkiidz", response.iterator().next().display().resource()); - Assertions.assertEquals("exznelixhnr", response.iterator().next().display().operation()); - Assertions.assertEquals("tfolhbnx", response.iterator().next().display().description()); - Assertions.assertEquals(false, response.iterator().next().isDataAction()); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/PageOfDataControllerResourceTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/PageOfDataControllerResourceTests.java deleted file mode 100644 index bd46d2c41f63..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/PageOfDataControllerResourceTests.java +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.fluent.models.DataControllerResourceInner; -import com.azure.resourcemanager.azurearcdata.models.DataControllerProperties; -import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; -import com.azure.resourcemanager.azurearcdata.models.ExtendedLocationTypes; -import com.azure.resourcemanager.azurearcdata.models.Infrastructure; -import com.azure.resourcemanager.azurearcdata.models.PageOfDataControllerResource; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class PageOfDataControllerResourceTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PageOfDataControllerResource model = - BinaryData - .fromString( - "{\"value\":[{\"extendedLocation\":{\"name\":\"cq\",\"type\":\"CustomLocation\"},\"properties\":{\"infrastructure\":\"azure\",\"k8sRaw\":\"dataudxytlmoyrx\",\"lastUploadedDate\":\"2021-03-16T12:34:31Z\",\"provisioningState\":\"ntxhdzhlrqjbhck\",\"clusterId\":\"lhrxsbkyvpyc\",\"extensionId\":\"uzbpzkafku\"},\"location\":\"crnwbmeh\",\"tags\":{\"deemao\":\"yvjusrtslhsp\",\"gkvtmelmqkrhah\":\"mx\",\"duala\":\"ljuahaquhcdh\",\"rcrgvx\":\"xqpvfadmw\"},\"id\":\"vgomz\",\"name\":\"fmisg\",\"type\":\"bnbbeldawkz\"},{\"extendedLocation\":{\"name\":\"io\",\"type\":\"CustomLocation\"},\"properties\":{\"infrastructure\":\"alibaba\",\"k8sRaw\":\"datauhashsfwx\",\"lastUploadedDate\":\"2021-11-02T12:01:24Z\",\"provisioningState\":\"gicjooxdjeb\",\"clusterId\":\"ucww\",\"extensionId\":\"ovbvmeueciv\"},\"location\":\"zceuojgjrw\",\"tags\":{\"nrjawgqwg\":\"iotwmcdytdxwit\",\"klwndnhjdauwhv\":\"hniskxfbkpyc\",\"zbtd\":\"l\"},\"id\":\"xujznbmpowu\",\"name\":\"przqlveu\",\"type\":\"lupj\"},{\"extendedLocation\":{\"name\":\"fxobbcsws\",\"type\":\"CustomLocation\"},\"properties\":{\"infrastructure\":\"alibaba\",\"k8sRaw\":\"datarbpbewtghfgblcg\",\"lastUploadedDate\":\"2021-01-14T04:37:45Z\",\"provisioningState\":\"jkbegibtnmxiebww\",\"clusterId\":\"oayqc\",\"extensionId\":\"rtzju\"},\"location\":\"wyzmhtxon\",\"tags\":{\"knftguvriuh\":\"savjcbpwxqps\"},\"id\":\"rwmdyvxqtay\",\"name\":\"iwwroyqbexrmc\",\"type\":\"ibycno\"}],\"nextLink\":\"knme\"}") - .toObject(PageOfDataControllerResource.class); - Assertions.assertEquals("crnwbmeh", model.value().get(0).location()); - Assertions.assertEquals("yvjusrtslhsp", model.value().get(0).tags().get("deemao")); - Assertions.assertEquals("cq", model.value().get(0).extendedLocation().name()); - Assertions.assertEquals(ExtendedLocationTypes.CUSTOM_LOCATION, model.value().get(0).extendedLocation().type()); - Assertions.assertEquals(Infrastructure.AZURE, model.value().get(0).properties().infrastructure()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-03-16T12:34:31Z"), model.value().get(0).properties().lastUploadedDate()); - Assertions.assertEquals("lhrxsbkyvpyc", model.value().get(0).properties().clusterId()); - Assertions.assertEquals("uzbpzkafku", model.value().get(0).properties().extensionId()); - Assertions.assertEquals("knme", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PageOfDataControllerResource model = - new PageOfDataControllerResource() - .withValue( - Arrays - .asList( - new DataControllerResourceInner() - .withLocation("crnwbmeh") - .withTags( - mapOf( - "deemao", - "yvjusrtslhsp", - "gkvtmelmqkrhah", - "mx", - "duala", - "ljuahaquhcdh", - "rcrgvx", - "xqpvfadmw")) - .withExtendedLocation( - new ExtendedLocation() - .withName("cq") - .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) - .withProperties( - new DataControllerProperties() - .withInfrastructure(Infrastructure.AZURE) - .withK8SRaw("dataudxytlmoyrx") - .withLastUploadedDate(OffsetDateTime.parse("2021-03-16T12:34:31Z")) - .withClusterId("lhrxsbkyvpyc") - .withExtensionId("uzbpzkafku")), - new DataControllerResourceInner() - .withLocation("zceuojgjrw") - .withTags( - mapOf("nrjawgqwg", "iotwmcdytdxwit", "klwndnhjdauwhv", "hniskxfbkpyc", "zbtd", "l")) - .withExtendedLocation( - new ExtendedLocation() - .withName("io") - .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) - .withProperties( - new DataControllerProperties() - .withInfrastructure(Infrastructure.ALIBABA) - .withK8SRaw("datauhashsfwx") - .withLastUploadedDate(OffsetDateTime.parse("2021-11-02T12:01:24Z")) - .withClusterId("ucww") - .withExtensionId("ovbvmeueciv")), - new DataControllerResourceInner() - .withLocation("wyzmhtxon") - .withTags(mapOf("knftguvriuh", "savjcbpwxqps")) - .withExtendedLocation( - new ExtendedLocation() - .withName("fxobbcsws") - .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) - .withProperties( - new DataControllerProperties() - .withInfrastructure(Infrastructure.ALIBABA) - .withK8SRaw("datarbpbewtghfgblcg") - .withLastUploadedDate(OffsetDateTime.parse("2021-01-14T04:37:45Z")) - .withClusterId("oayqc") - .withExtensionId("rtzju")))) - .withNextLink("knme"); - model = BinaryData.fromObject(model).toObject(PageOfDataControllerResource.class); - Assertions.assertEquals("crnwbmeh", model.value().get(0).location()); - Assertions.assertEquals("yvjusrtslhsp", model.value().get(0).tags().get("deemao")); - Assertions.assertEquals("cq", model.value().get(0).extendedLocation().name()); - Assertions.assertEquals(ExtendedLocationTypes.CUSTOM_LOCATION, model.value().get(0).extendedLocation().type()); - Assertions.assertEquals(Infrastructure.AZURE, model.value().get(0).properties().infrastructure()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-03-16T12:34:31Z"), model.value().get(0).properties().lastUploadedDate()); - Assertions.assertEquals("lhrxsbkyvpyc", model.value().get(0).properties().clusterId()); - Assertions.assertEquals("uzbpzkafku", model.value().get(0).properties().extensionId()); - Assertions.assertEquals("knme", model.nextLink()); - } - - @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/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceK8SRawTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceK8SRawTests.java deleted file mode 100644 index 33973b557fd3..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceK8SRawTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.K8SScheduling; -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SRaw; -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SSpec; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class SqlManagedInstanceK8SRawTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlManagedInstanceK8SRaw model = - BinaryData - .fromString( - "{\"spec\":{\"scheduling\":{\"\":{\"jtjaodxobnbdxkq\":\"dataerhhbcsglumm\",\"ajionpimexgstxg\":\"dataxo\",\"gmaajrm\":\"datapo\",\"clwhijcoejctbz\":\"datadjwzrlov\"}},\"replicas\":21849341,\"\":{\"bkbfkgukdkex\":\"datay\",\"ocjjxhvpmouexh\":\"datappofmxaxcfjpgdd\"}},\"\":{\"qeojnxqbzvddntw\":\"datai\",\"vuhrhcffcyddgl\":\"datadeicbtwnpzao\",\"xmqci\":\"datajthjqkwpyei\"}}") - .toObject(SqlManagedInstanceK8SRaw.class); - Assertions.assertEquals(21849341, model.spec().replicas()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlManagedInstanceK8SRaw model = - new SqlManagedInstanceK8SRaw() - .withSpec( - new SqlManagedInstanceK8SSpec() - .withScheduling(new K8SScheduling().withAdditionalProperties(mapOf())) - .withReplicas(21849341) - .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf()); - model = BinaryData.fromObject(model).toObject(SqlManagedInstanceK8SRaw.class); - Assertions.assertEquals(21849341, model.spec().replicas()); - } - - @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/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceK8SSpecTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceK8SSpecTests.java deleted file mode 100644 index 5921e026f071..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceK8SSpecTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.K8SScheduling; -import com.azure.resourcemanager.azurearcdata.models.K8SSchedulingOptions; -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SSpec; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class SqlManagedInstanceK8SSpecTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlManagedInstanceK8SSpec model = - BinaryData - .fromString( - "{\"scheduling\":{\"default\":{\"\":{\"ghmewuam\":\"dataixuigdtopbobj\"}},\"\":{\"t\":\"datarzayv\",\"ln\":\"datagvdfgiotkftutq\",\"qmi\":\"dataxlefgugnxkrx\",\"abhjybi\":\"datatthzrvqd\"}},\"replicas\":212297341,\"\":{\"zlcuiywgqywgndrv\":\"datafbowskanyk\",\"ocpecfvmmco\":\"datanhzgpphrcgyn\"}}") - .toObject(SqlManagedInstanceK8SSpec.class); - Assertions.assertEquals(212297341, model.replicas()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlManagedInstanceK8SSpec model = - new SqlManagedInstanceK8SSpec() - .withScheduling( - new K8SScheduling() - .withDefaultProperty(new K8SSchedulingOptions().withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf())) - .withReplicas(212297341) - .withAdditionalProperties(mapOf()); - model = BinaryData.fromObject(model).toObject(SqlManagedInstanceK8SSpec.class); - Assertions.assertEquals(212297341, model.replicas()); - } - - @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/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceListResultTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceListResultTests.java deleted file mode 100644 index 893b5b84af52..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceListResultTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceListResult; - -public final class SqlManagedInstanceListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlManagedInstanceListResult model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"dataControllerId\":\"ryffdfdosy\",\"admin\":\"xpaojakhmsbz\",\"startTime\":\"crzevdphlx\",\"endTime\":\"lthqtrgqjbp\",\"lastUploadedDate\":\"2021-02-11T10:14:36Z\",\"provisioningState\":\"zgvfcjrwz\",\"licenseType\":\"LicenseIncluded\",\"clusterId\":\"tfell\",\"extensionId\":\"fziton\"},\"extendedLocation\":{\"name\":\"fpjkjlxofp\",\"type\":\"CustomLocation\"},\"sku\":{\"tier\":\"BusinessCritical\",\"dev\":false,\"size\":\"ininmay\",\"family\":\"ybb\",\"capacity\":49478059},\"location\":\"epoo\",\"tags\":{\"eotusivyevc\":\"uvamiheognarxzxt\",\"un\":\"iqihn\",\"fygxgispemvtzfk\":\"bwjzr\"},\"id\":\"fublj\",\"name\":\"fxqeof\",\"type\":\"aeqjhqjbasvms\"},{\"properties\":{\"dataControllerId\":\"qulngsntnbybkzgc\",\"admin\":\"wclxxwrl\",\"startTime\":\"ouskcqvkocrc\",\"endTime\":\"kwt\",\"lastUploadedDate\":\"2020-12-21T11:33:13Z\",\"provisioningState\":\"biksq\",\"licenseType\":\"BasePrice\",\"clusterId\":\"sainqpjwnzl\",\"extensionId\":\"fmppe\"},\"extendedLocation\":{\"name\":\"mgxsab\",\"type\":\"CustomLocation\"},\"sku\":{\"tier\":\"GeneralPurpose\",\"dev\":false,\"size\":\"c\",\"family\":\"zdzevndh\",\"capacity\":968287955},\"location\":\"d\",\"tags\":{\"usnhutje\":\"dsbdkvwrwjf\"},\"id\":\"tmrldhugjzzdatq\",\"name\":\"hocdgeab\",\"type\":\"gphuticndvka\"},{\"properties\":{\"dataControllerId\":\"wyiftyhxhur\",\"admin\":\"ftyxolniw\",\"startTime\":\"cukjf\",\"endTime\":\"iawxklry\",\"lastUploadedDate\":\"2021-10-07T14:36:38Z\",\"provisioningState\":\"asy\",\"licenseType\":\"LicenseIncluded\",\"clusterId\":\"dhsgcba\",\"extensionId\":\"hejkotynqgou\"},\"extendedLocation\":{\"name\":\"dlikwyqkgfgibma\",\"type\":\"CustomLocation\"},\"sku\":{\"tier\":\"BusinessCritical\",\"dev\":false,\"size\":\"yb\",\"family\":\"qedqytbciqfoufl\",\"capacity\":1004345628},\"location\":\"zsm\",\"tags\":{\"tmut\":\"glougpbk\",\"pwgcuertu\":\"uqktap\",\"bmdg\":\"kdosvqw\"},\"id\":\"bjf\",\"name\":\"dgmb\",\"type\":\"bexppb\"}],\"nextLink\":\"q\"}") - .toObject(SqlManagedInstanceListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlManagedInstanceListResult model = new SqlManagedInstanceListResult(); - model = BinaryData.fromObject(model).toObject(SqlManagedInstanceListResult.class); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceSkuTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceSkuTests.java deleted file mode 100644 index f69b202ebf47..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceSkuTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceSku; -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceSkuTier; -import org.junit.jupiter.api.Assertions; - -public final class SqlManagedInstanceSkuTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlManagedInstanceSku model = - BinaryData - .fromString( - "{\"tier\":\"GeneralPurpose\",\"dev\":true,\"size\":\"kwlhzdo\",\"family\":\"xjmflbvv\",\"capacity\":681133133}") - .toObject(SqlManagedInstanceSku.class); - Assertions.assertEquals(SqlManagedInstanceSkuTier.GENERAL_PURPOSE, model.tier()); - Assertions.assertEquals(true, model.dev()); - Assertions.assertEquals("kwlhzdo", model.size()); - Assertions.assertEquals("xjmflbvv", model.family()); - Assertions.assertEquals(681133133, model.capacity()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlManagedInstanceSku model = - new SqlManagedInstanceSku() - .withTier(SqlManagedInstanceSkuTier.GENERAL_PURPOSE) - .withDev(true) - .withSize("kwlhzdo") - .withFamily("xjmflbvv") - .withCapacity(681133133); - model = BinaryData.fromObject(model).toObject(SqlManagedInstanceSku.class); - Assertions.assertEquals(SqlManagedInstanceSkuTier.GENERAL_PURPOSE, model.tier()); - Assertions.assertEquals(true, model.dev()); - Assertions.assertEquals("kwlhzdo", model.size()); - Assertions.assertEquals("xjmflbvv", model.family()); - Assertions.assertEquals(681133133, model.capacity()); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceUpdateTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceUpdateTests.java deleted file mode 100644 index 0a72a6d17bf0..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceUpdateTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceUpdate; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class SqlManagedInstanceUpdateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlManagedInstanceUpdate model = - BinaryData - .fromString( - "{\"tags\":{\"zjuqkhrsaj\":\"cciw\",\"mjmvxieduugidyjr\":\"wkuofoskghsauu\",\"y\":\"f\",\"hslkevleggzf\":\"osvexcsonpclhoc\"}}") - .toObject(SqlManagedInstanceUpdate.class); - Assertions.assertEquals("cciw", model.tags().get("zjuqkhrsaj")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlManagedInstanceUpdate model = - new SqlManagedInstanceUpdate() - .withTags( - mapOf( - "zjuqkhrsaj", - "cciw", - "mjmvxieduugidyjr", - "wkuofoskghsauu", - "y", - "f", - "hslkevleggzf", - "osvexcsonpclhoc")); - model = BinaryData.fromObject(model).toObject(SqlManagedInstanceUpdate.class); - Assertions.assertEquals("cciw", model.tags().get("zjuqkhrsaj")); - } - - @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/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesDeleteMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesDeleteMockTests.java deleted file mode 100644 index b999c72d9eb9..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesDeleteMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class SqlManagedInstancesDeleteMockTests { - @Test - public void testDelete() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - AzureArcDataManager manager = - AzureArcDataManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.sqlManagedInstances().delete("jmkcjhwqytj", "ybn", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceInnerTests.java deleted file mode 100644 index 064c62863325..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceInnerTests.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceInner; -import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType; -import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus; -import com.azure.resourcemanager.azurearcdata.models.DefenderStatus; -import com.azure.resourcemanager.azurearcdata.models.EditionType; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties; -import com.azure.resourcemanager.azurearcdata.models.SqlVersion; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class SqlServerInstanceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlServerInstanceInner model = - BinaryData - .fromString( - "{\"properties\":{\"version\":\"SQL Server" - + " 2016\",\"edition\":\"Express\",\"containerResourceId\":\"walm\",\"createTime\":\"yoxa\",\"vCore\":\"dkzjancuxrh\",\"status\":\"Disconnected\",\"patchLevel\":\"avxbniwdjswztsdb\",\"collation\":\"nxytxh\",\"currentVersion\":\"xbzpfzab\",\"instanceName\":\"cuh\",\"tcpDynamicPorts\":\"tcty\",\"tcpStaticPorts\":\"klbb\",\"productId\":\"plwzbhvgyugu\",\"licenseType\":\"HADR\",\"azureDefenderStatusLastUpdated\":\"2021-10-31T02:07:56Z\",\"azureDefenderStatus\":\"Unprotected\",\"provisioningState\":\"xquk\"},\"location\":\"plgmgsxnk\",\"tags\":{\"lopwiyig\":\"deslp\"},\"id\":\"xpkd\",\"name\":\"zb\",\"type\":\"iuebbaumny\"}") - .toObject(SqlServerInstanceInner.class); - Assertions.assertEquals("plgmgsxnk", model.location()); - Assertions.assertEquals("deslp", model.tags().get("lopwiyig")); - Assertions.assertEquals(SqlVersion.SQL_SERVER_2016, model.properties().version()); - Assertions.assertEquals(EditionType.EXPRESS, model.properties().edition()); - Assertions.assertEquals("walm", model.properties().containerResourceId()); - Assertions.assertEquals("dkzjancuxrh", model.properties().vCore()); - Assertions.assertEquals(ConnectionStatus.DISCONNECTED, model.properties().status()); - Assertions.assertEquals("avxbniwdjswztsdb", model.properties().patchLevel()); - Assertions.assertEquals("nxytxh", model.properties().collation()); - Assertions.assertEquals("xbzpfzab", model.properties().currentVersion()); - Assertions.assertEquals("cuh", model.properties().instanceName()); - Assertions.assertEquals("tcty", model.properties().tcpDynamicPorts()); - Assertions.assertEquals("klbb", model.properties().tcpStaticPorts()); - Assertions.assertEquals("plwzbhvgyugu", model.properties().productId()); - Assertions.assertEquals(ArcSqlServerLicenseType.HADR, model.properties().licenseType()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-10-31T02:07:56Z"), model.properties().azureDefenderStatusLastUpdated()); - Assertions.assertEquals(DefenderStatus.UNPROTECTED, model.properties().azureDefenderStatus()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlServerInstanceInner model = - new SqlServerInstanceInner() - .withLocation("plgmgsxnk") - .withTags(mapOf("lopwiyig", "deslp")) - .withProperties( - new SqlServerInstanceProperties() - .withVersion(SqlVersion.SQL_SERVER_2016) - .withEdition(EditionType.EXPRESS) - .withContainerResourceId("walm") - .withVCore("dkzjancuxrh") - .withStatus(ConnectionStatus.DISCONNECTED) - .withPatchLevel("avxbniwdjswztsdb") - .withCollation("nxytxh") - .withCurrentVersion("xbzpfzab") - .withInstanceName("cuh") - .withTcpDynamicPorts("tcty") - .withTcpStaticPorts("klbb") - .withProductId("plwzbhvgyugu") - .withLicenseType(ArcSqlServerLicenseType.HADR) - .withAzureDefenderStatusLastUpdated(OffsetDateTime.parse("2021-10-31T02:07:56Z")) - .withAzureDefenderStatus(DefenderStatus.UNPROTECTED)); - model = BinaryData.fromObject(model).toObject(SqlServerInstanceInner.class); - Assertions.assertEquals("plgmgsxnk", model.location()); - Assertions.assertEquals("deslp", model.tags().get("lopwiyig")); - Assertions.assertEquals(SqlVersion.SQL_SERVER_2016, model.properties().version()); - Assertions.assertEquals(EditionType.EXPRESS, model.properties().edition()); - Assertions.assertEquals("walm", model.properties().containerResourceId()); - Assertions.assertEquals("dkzjancuxrh", model.properties().vCore()); - Assertions.assertEquals(ConnectionStatus.DISCONNECTED, model.properties().status()); - Assertions.assertEquals("avxbniwdjswztsdb", model.properties().patchLevel()); - Assertions.assertEquals("nxytxh", model.properties().collation()); - Assertions.assertEquals("xbzpfzab", model.properties().currentVersion()); - Assertions.assertEquals("cuh", model.properties().instanceName()); - Assertions.assertEquals("tcty", model.properties().tcpDynamicPorts()); - Assertions.assertEquals("klbb", model.properties().tcpStaticPorts()); - Assertions.assertEquals("plwzbhvgyugu", model.properties().productId()); - Assertions.assertEquals(ArcSqlServerLicenseType.HADR, model.properties().licenseType()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-10-31T02:07:56Z"), model.properties().azureDefenderStatusLastUpdated()); - Assertions.assertEquals(DefenderStatus.UNPROTECTED, model.properties().azureDefenderStatus()); - } - - @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/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceListResultTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceListResultTests.java deleted file mode 100644 index 106763ddfb30..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceListResultTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceListResult; - -public final class SqlServerInstanceListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlServerInstanceListResult model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"version\":\"SQL Server" - + " 2016\",\"edition\":\"Express\",\"containerResourceId\":\"x\",\"createTime\":\"feiithlvmez\",\"vCore\":\"shxmzsbbzoggigrx\",\"status\":\"Connected\",\"patchLevel\":\"rvjx\",\"collation\":\"nspydptkoenkoukn\",\"currentVersion\":\"dwtiukbldngkp\",\"instanceName\":\"ipazyxoegukgjnpi\",\"tcpDynamicPorts\":\"gygev\",\"tcpStaticPorts\":\"ntypmrbpizcdrqj\",\"productId\":\"pyd\",\"licenseType\":\"Undefined\",\"azureDefenderStatusLastUpdated\":\"2021-08-04T14:21:07Z\",\"azureDefenderStatus\":\"Unknown\",\"provisioningState\":\"ejzicwifsjtt\"},\"location\":\"fbishcbkha\",\"tags\":{\"xw\":\"yeamdphagalpb\",\"shwankixzbinje\":\"ipwhonowk\"},\"id\":\"uttmrywnuzoqft\",\"name\":\"yqzrnkcqvyxlw\",\"type\":\"zlsico\"},{\"properties\":{\"version\":\"SQL" - + " Server" - + " 2017\",\"edition\":\"Express\",\"containerResourceId\":\"vlryavwhheunmmq\",\"createTime\":\"yxzk\",\"vCore\":\"ocukoklyax\",\"status\":\"Unknown\",\"patchLevel\":\"nuqszfkbey\",\"collation\":\"wrmjmwvvjektc\",\"currentVersion\":\"enhwlrs\",\"instanceName\":\"rzpwvlqdqgbiq\",\"tcpDynamicPorts\":\"ihkaetcktvfc\",\"tcpStaticPorts\":\"fsnkymuctq\",\"productId\":\"fbebrjcxer\",\"licenseType\":\"HADR\",\"azureDefenderStatusLastUpdated\":\"2021-09-07T01:58:14Z\",\"azureDefenderStatus\":\"Unknown\",\"provisioningState\":\"fvjrbirphxepcy\"},\"location\":\"hfnljkyq\",\"tags\":{\"gvcl\":\"uujqgidokgjljyo\",\"jhtxfvgxbfsmxne\":\"bgsncghkjeszzhb\"},\"id\":\"mpvecxgodebfqk\",\"name\":\"rbmpukgri\",\"type\":\"flz\"},{\"properties\":{\"version\":\"SQL" - + " Server" - + " 2016\",\"edition\":\"Web\",\"containerResourceId\":\"uzycispnqza\",\"createTime\":\"gkbrpyyd\",\"vCore\":\"bnuqqkpik\",\"status\":\"Disconnected\",\"patchLevel\":\"gvtqagnbuynh\",\"collation\":\"gg\",\"currentVersion\":\"bfs\",\"instanceName\":\"rbu\",\"tcpDynamicPorts\":\"cvpnazzmhjrunmpx\",\"tcpStaticPorts\":\"dbhrbnlankxm\",\"productId\":\"k\",\"licenseType\":\"Undefined\",\"azureDefenderStatusLastUpdated\":\"2021-05-05T04:59:18Z\",\"azureDefenderStatus\":\"Unknown\",\"provisioningState\":\"cxy\"},\"location\":\"y\",\"tags\":{\"haaxdbabphl\":\"synlqidybyxczfc\"},\"id\":\"rqlfktsthsucocmn\",\"name\":\"yazttbtwwrqpue\",\"type\":\"ckzywbiexzfeyue\"}],\"nextLink\":\"ibx\"}") - .toObject(SqlServerInstanceListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlServerInstanceListResult model = new SqlServerInstanceListResult(); - model = BinaryData.fromObject(model).toObject(SqlServerInstanceListResult.class); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancePropertiesTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancePropertiesTests.java deleted file mode 100644 index 8ce0ffc686be..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancePropertiesTests.java +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType; -import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus; -import com.azure.resourcemanager.azurearcdata.models.DefenderStatus; -import com.azure.resourcemanager.azurearcdata.models.EditionType; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties; -import com.azure.resourcemanager.azurearcdata.models.SqlVersion; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class SqlServerInstancePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlServerInstanceProperties model = - BinaryData - .fromString( - "{\"version\":\"SQL Server" - + " 2017\",\"edition\":\"Evaluation\",\"containerResourceId\":\"eojnabc\",\"createTime\":\"smtxpsieb\",\"vCore\":\"hvpesapskrdqm\",\"status\":\"Unknown\",\"patchLevel\":\"dhtldwkyz\",\"collation\":\"utknc\",\"currentVersion\":\"cwsvlxotog\",\"instanceName\":\"rupqsxvnmicy\",\"tcpDynamicPorts\":\"ceoveilovno\",\"tcpStaticPorts\":\"fj\",\"productId\":\"njbkcnxdhbttkph\",\"licenseType\":\"Undefined\",\"azureDefenderStatusLastUpdated\":\"2021-09-28T11:00:41Z\",\"azureDefenderStatus\":\"Unknown\",\"provisioningState\":\"qnermclfplphoxu\"}") - .toObject(SqlServerInstanceProperties.class); - Assertions.assertEquals(SqlVersion.SQL_SERVER_2017, model.version()); - Assertions.assertEquals(EditionType.EVALUATION, model.edition()); - Assertions.assertEquals("eojnabc", model.containerResourceId()); - Assertions.assertEquals("hvpesapskrdqm", model.vCore()); - Assertions.assertEquals(ConnectionStatus.UNKNOWN, model.status()); - Assertions.assertEquals("dhtldwkyz", model.patchLevel()); - Assertions.assertEquals("utknc", model.collation()); - Assertions.assertEquals("cwsvlxotog", model.currentVersion()); - Assertions.assertEquals("rupqsxvnmicy", model.instanceName()); - Assertions.assertEquals("ceoveilovno", model.tcpDynamicPorts()); - Assertions.assertEquals("fj", model.tcpStaticPorts()); - Assertions.assertEquals("njbkcnxdhbttkph", model.productId()); - Assertions.assertEquals(ArcSqlServerLicenseType.UNDEFINED, model.licenseType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-28T11:00:41Z"), model.azureDefenderStatusLastUpdated()); - Assertions.assertEquals(DefenderStatus.UNKNOWN, model.azureDefenderStatus()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlServerInstanceProperties model = - new SqlServerInstanceProperties() - .withVersion(SqlVersion.SQL_SERVER_2017) - .withEdition(EditionType.EVALUATION) - .withContainerResourceId("eojnabc") - .withVCore("hvpesapskrdqm") - .withStatus(ConnectionStatus.UNKNOWN) - .withPatchLevel("dhtldwkyz") - .withCollation("utknc") - .withCurrentVersion("cwsvlxotog") - .withInstanceName("rupqsxvnmicy") - .withTcpDynamicPorts("ceoveilovno") - .withTcpStaticPorts("fj") - .withProductId("njbkcnxdhbttkph") - .withLicenseType(ArcSqlServerLicenseType.UNDEFINED) - .withAzureDefenderStatusLastUpdated(OffsetDateTime.parse("2021-09-28T11:00:41Z")) - .withAzureDefenderStatus(DefenderStatus.UNKNOWN); - model = BinaryData.fromObject(model).toObject(SqlServerInstanceProperties.class); - Assertions.assertEquals(SqlVersion.SQL_SERVER_2017, model.version()); - Assertions.assertEquals(EditionType.EVALUATION, model.edition()); - Assertions.assertEquals("eojnabc", model.containerResourceId()); - Assertions.assertEquals("hvpesapskrdqm", model.vCore()); - Assertions.assertEquals(ConnectionStatus.UNKNOWN, model.status()); - Assertions.assertEquals("dhtldwkyz", model.patchLevel()); - Assertions.assertEquals("utknc", model.collation()); - Assertions.assertEquals("cwsvlxotog", model.currentVersion()); - Assertions.assertEquals("rupqsxvnmicy", model.instanceName()); - Assertions.assertEquals("ceoveilovno", model.tcpDynamicPorts()); - Assertions.assertEquals("fj", model.tcpStaticPorts()); - Assertions.assertEquals("njbkcnxdhbttkph", model.productId()); - Assertions.assertEquals(ArcSqlServerLicenseType.UNDEFINED, model.licenseType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-28T11:00:41Z"), model.azureDefenderStatusLastUpdated()); - Assertions.assertEquals(DefenderStatus.UNKNOWN, model.azureDefenderStatus()); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceUpdateTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceUpdateTests.java deleted file mode 100644 index d5282f00f283..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceUpdateTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceUpdate; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class SqlServerInstanceUpdateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlServerInstanceUpdate model = - BinaryData - .fromString("{\"tags\":{\"jta\":\"pabgyeps\",\"kqujidsuyono\":\"qugxywpmueefjzwf\"}}") - .toObject(SqlServerInstanceUpdate.class); - Assertions.assertEquals("pabgyeps", model.tags().get("jta")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlServerInstanceUpdate model = - new SqlServerInstanceUpdate().withTags(mapOf("jta", "pabgyeps", "kqujidsuyono", "qugxywpmueefjzwf")); - model = BinaryData.fromObject(model).toObject(SqlServerInstanceUpdate.class); - Assertions.assertEquals("pabgyeps", model.tags().get("jta")); - } - - @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/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesCreateMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesCreateMockTests.java deleted file mode 100644 index 6bd292fe9839..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesCreateMockTests.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; -import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType; -import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus; -import com.azure.resourcemanager.azurearcdata.models.DefenderStatus; -import com.azure.resourcemanager.azurearcdata.models.EditionType; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstance; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties; -import com.azure.resourcemanager.azurearcdata.models.SqlVersion; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class SqlServerInstancesCreateMockTests { - @Test - public void testCreate() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"version\":\"SQL Server" - + " 2016\",\"edition\":\"Developer\",\"containerResourceId\":\"fpubjibwwi\",\"createTime\":\"ohqkvpuvksgpls\",\"vCore\":\"nynfsynljphuo\",\"status\":\"Disconnected\",\"patchLevel\":\"dlqiyntorzih\",\"collation\":\"osjswsr\",\"currentVersion\":\"lyzrpzbchckqqzqi\",\"instanceName\":\"iysui\",\"tcpDynamicPorts\":\"ynkedyatrwyhqmib\",\"tcpStaticPorts\":\"hwit\",\"productId\":\"ypyynpcdpumnzg\",\"licenseType\":\"Paid\",\"azureDefenderStatusLastUpdated\":\"2021-05-04T13:21:35Z\",\"azureDefenderStatus\":\"Unknown\",\"provisioningState\":\"Succeeded\"},\"location\":\"jhxbld\",\"tags\":{\"vokotllxdyh\":\"wrlkdmtn\",\"oocrkvcikhnv\":\"syocogjltdtbnnha\",\"gxk\":\"amqgxqquezikyw\"},\"id\":\"lla\",\"name\":\"melwuipiccjz\",\"type\":\"z\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - AzureArcDataManager manager = - AzureArcDataManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - SqlServerInstance response = - manager - .sqlServerInstances() - .define("hwflu") - .withRegion("eqnovvqfovl") - .withExistingResourceGroup("qyib") - .withTags(mapOf("ndsytgadg", "wsuwsyr", "ea", "r")) - .withProperties( - new SqlServerInstanceProperties() - .withVersion(SqlVersion.SQL_SERVER_2019) - .withEdition(EditionType.STANDARD) - .withContainerResourceId("rkwofyyvoqa") - .withVCore("washr") - .withStatus(ConnectionStatus.DISCONNECTED) - .withPatchLevel("kcnqxwbpo") - .withCollation("lpiujwaa") - .withCurrentVersion("pqiiobyuqe") - .withInstanceName("qlpqwcciuq") - .withTcpDynamicPorts("dbutauvfbtkuwhh") - .withTcpStaticPorts("ykojoxafnndlpic") - .withProductId("o") - .withLicenseType(ArcSqlServerLicenseType.FREE) - .withAzureDefenderStatusLastUpdated(OffsetDateTime.parse("2021-10-22T11:40:28Z")) - .withAzureDefenderStatus(DefenderStatus.UNPROTECTED)) - .create(); - - Assertions.assertEquals("jhxbld", response.location()); - Assertions.assertEquals("wrlkdmtn", response.tags().get("vokotllxdyh")); - Assertions.assertEquals(SqlVersion.SQL_SERVER_2016, response.properties().version()); - Assertions.assertEquals(EditionType.DEVELOPER, response.properties().edition()); - Assertions.assertEquals("fpubjibwwi", response.properties().containerResourceId()); - Assertions.assertEquals("nynfsynljphuo", response.properties().vCore()); - Assertions.assertEquals(ConnectionStatus.DISCONNECTED, response.properties().status()); - Assertions.assertEquals("dlqiyntorzih", response.properties().patchLevel()); - Assertions.assertEquals("osjswsr", response.properties().collation()); - Assertions.assertEquals("lyzrpzbchckqqzqi", response.properties().currentVersion()); - Assertions.assertEquals("iysui", response.properties().instanceName()); - Assertions.assertEquals("ynkedyatrwyhqmib", response.properties().tcpDynamicPorts()); - Assertions.assertEquals("hwit", response.properties().tcpStaticPorts()); - Assertions.assertEquals("ypyynpcdpumnzg", response.properties().productId()); - Assertions.assertEquals(ArcSqlServerLicenseType.PAID, response.properties().licenseType()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-05-04T13:21:35Z"), response.properties().azureDefenderStatusLastUpdated()); - Assertions.assertEquals(DefenderStatus.UNKNOWN, response.properties().azureDefenderStatus()); - } - - @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/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesDeleteMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesDeleteMockTests.java deleted file mode 100644 index cdb5a1e5cbe9..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesDeleteMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class SqlServerInstancesDeleteMockTests { - @Test - public void testDelete() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - AzureArcDataManager manager = - AzureArcDataManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.sqlServerInstances().delete("i", "m", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetByResourceGroupWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetByResourceGroupWithResponseMockTests.java deleted file mode 100644 index e18dc4b8ce1d..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetByResourceGroupWithResponseMockTests.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; -import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType; -import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus; -import com.azure.resourcemanager.azurearcdata.models.DefenderStatus; -import com.azure.resourcemanager.azurearcdata.models.EditionType; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstance; -import com.azure.resourcemanager.azurearcdata.models.SqlVersion; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class SqlServerInstancesGetByResourceGroupWithResponseMockTests { - @Test - public void testGetByResourceGroupWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"version\":\"SQL Server" - + " 2019\",\"edition\":\"Express\",\"containerResourceId\":\"vnhdldwmgxcxr\",\"createTime\":\"pmutwuo\",\"vCore\":\"rpkhjwn\",\"status\":\"Connected\",\"patchLevel\":\"sluicpdggkzz\",\"collation\":\"mbmpaxmodfvuefy\",\"currentVersion\":\"bpfvm\",\"instanceName\":\"hrfou\",\"tcpDynamicPorts\":\"taakc\",\"tcpStaticPorts\":\"iyzvqtmnub\",\"productId\":\"kpzksmondjmq\",\"licenseType\":\"Undefined\",\"azureDefenderStatusLastUpdated\":\"2021-02-28T11:46:10Z\",\"azureDefenderStatus\":\"Protected\",\"provisioningState\":\"kopkwhojvpajqgx\"},\"location\":\"mocmbqfqvmk\",\"tags\":{\"rgly\":\"zapvhelx\"},\"id\":\"tddckcb\",\"name\":\"uejrjxgc\",\"type\":\"qibrhosxsdqrhzoy\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - AzureArcDataManager manager = - AzureArcDataManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - SqlServerInstance response = - manager - .sqlServerInstances() - .getByResourceGroupWithResponse("rhvoods", "tbobz", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("mocmbqfqvmk", response.location()); - Assertions.assertEquals("zapvhelx", response.tags().get("rgly")); - Assertions.assertEquals(SqlVersion.SQL_SERVER_2019, response.properties().version()); - Assertions.assertEquals(EditionType.EXPRESS, response.properties().edition()); - Assertions.assertEquals("vnhdldwmgxcxr", response.properties().containerResourceId()); - Assertions.assertEquals("rpkhjwn", response.properties().vCore()); - Assertions.assertEquals(ConnectionStatus.CONNECTED, response.properties().status()); - Assertions.assertEquals("sluicpdggkzz", response.properties().patchLevel()); - Assertions.assertEquals("mbmpaxmodfvuefy", response.properties().collation()); - Assertions.assertEquals("bpfvm", response.properties().currentVersion()); - Assertions.assertEquals("hrfou", response.properties().instanceName()); - Assertions.assertEquals("taakc", response.properties().tcpDynamicPorts()); - Assertions.assertEquals("iyzvqtmnub", response.properties().tcpStaticPorts()); - Assertions.assertEquals("kpzksmondjmq", response.properties().productId()); - Assertions.assertEquals(ArcSqlServerLicenseType.UNDEFINED, response.properties().licenseType()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-02-28T11:46:10Z"), response.properties().azureDefenderStatusLastUpdated()); - Assertions.assertEquals(DefenderStatus.PROTECTED, response.properties().azureDefenderStatus()); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListByResourceGroupMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListByResourceGroupMockTests.java deleted file mode 100644 index eea4eaf70691..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListByResourceGroupMockTests.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; -import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType; -import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus; -import com.azure.resourcemanager.azurearcdata.models.DefenderStatus; -import com.azure.resourcemanager.azurearcdata.models.EditionType; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstance; -import com.azure.resourcemanager.azurearcdata.models.SqlVersion; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class SqlServerInstancesListByResourceGroupMockTests { - @Test - public void testListByResourceGroup() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"version\":\"SQL Server" - + " 2017\",\"edition\":\"Enterprise\",\"containerResourceId\":\"podxunkb\",\"createTime\":\"xmubyyntwlrbq\",\"vCore\":\"oievseotgqrlltm\",\"status\":\"Unknown\",\"patchLevel\":\"auwzizxbmpgc\",\"collation\":\"fuzmuvpbtt\",\"currentVersion\":\"morppxebmnzbtbh\",\"instanceName\":\"glkfg\",\"tcpDynamicPorts\":\"dneu\",\"tcpStaticPorts\":\"fphsdyhtozfikdow\",\"productId\":\"uuvxz\",\"licenseType\":\"Undefined\",\"azureDefenderStatusLastUpdated\":\"2021-05-15T02:55:17Z\",\"azureDefenderStatus\":\"Unprotected\",\"provisioningState\":\"qzonosggbhcohf\"},\"location\":\"sjnkal\",\"tags\":{\"kfvhqcrailvpn\":\"iiswacffgdkzze\",\"mh\":\"pfuflrw\",\"sag\":\"lxyjr\"},\"id\":\"fcnihgwq\",\"name\":\"pnedgf\",\"type\":\"cvkcvqvpkeqdcv\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - AzureArcDataManager manager = - AzureArcDataManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.sqlServerInstances().listByResourceGroup("akbogqxndlkzgxh", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("sjnkal", response.iterator().next().location()); - Assertions.assertEquals("iiswacffgdkzze", response.iterator().next().tags().get("kfvhqcrailvpn")); - Assertions.assertEquals(SqlVersion.SQL_SERVER_2017, response.iterator().next().properties().version()); - Assertions.assertEquals(EditionType.ENTERPRISE, response.iterator().next().properties().edition()); - Assertions.assertEquals("podxunkb", response.iterator().next().properties().containerResourceId()); - Assertions.assertEquals("oievseotgqrlltm", response.iterator().next().properties().vCore()); - Assertions.assertEquals(ConnectionStatus.UNKNOWN, response.iterator().next().properties().status()); - Assertions.assertEquals("auwzizxbmpgc", response.iterator().next().properties().patchLevel()); - Assertions.assertEquals("fuzmuvpbtt", response.iterator().next().properties().collation()); - Assertions.assertEquals("morppxebmnzbtbh", response.iterator().next().properties().currentVersion()); - Assertions.assertEquals("glkfg", response.iterator().next().properties().instanceName()); - Assertions.assertEquals("dneu", response.iterator().next().properties().tcpDynamicPorts()); - Assertions.assertEquals("fphsdyhtozfikdow", response.iterator().next().properties().tcpStaticPorts()); - Assertions.assertEquals("uuvxz", response.iterator().next().properties().productId()); - Assertions - .assertEquals(ArcSqlServerLicenseType.UNDEFINED, response.iterator().next().properties().licenseType()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-05-15T02:55:17Z"), - response.iterator().next().properties().azureDefenderStatusLastUpdated()); - Assertions - .assertEquals(DefenderStatus.UNPROTECTED, response.iterator().next().properties().azureDefenderStatus()); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListMockTests.java deleted file mode 100644 index 2024da23f816..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListMockTests.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; -import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType; -import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus; -import com.azure.resourcemanager.azurearcdata.models.DefenderStatus; -import com.azure.resourcemanager.azurearcdata.models.EditionType; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstance; -import com.azure.resourcemanager.azurearcdata.models.SqlVersion; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class SqlServerInstancesListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"version\":\"SQL Server" - + " 2019\",\"edition\":\"Developer\",\"containerResourceId\":\"r\",\"createTime\":\"ccymvaolpsslql\",\"vCore\":\"mdnbbglzpswiy\",\"status\":\"Connected\",\"patchLevel\":\"wyhzdx\",\"collation\":\"adbzmnvdfznud\",\"currentVersion\":\"dvxzbncblylpst\",\"instanceName\":\"hh\",\"tcpDynamicPorts\":\"rzdzucerscdnt\",\"tcpStaticPorts\":\"vfiwjmygtdss\",\"productId\":\"wtmwerio\",\"licenseType\":\"Paid\",\"azureDefenderStatusLastUpdated\":\"2021-06-08T10:58:30Z\",\"azureDefenderStatus\":\"Unprotected\",\"provisioningState\":\"wab\"},\"location\":\"tshhszhedp\",\"tags\":{\"wtppjflcxogaoko\":\"iwubmwmbesldnk\",\"nsikvmkqzeqqkdl\":\"z\"},\"id\":\"fzxmhhvhgureodkw\",\"name\":\"bdagxt\",\"type\":\"bqdxbx\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - AzureArcDataManager manager = - AzureArcDataManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.sqlServerInstances().list(com.azure.core.util.Context.NONE); - - Assertions.assertEquals("tshhszhedp", response.iterator().next().location()); - Assertions.assertEquals("iwubmwmbesldnk", response.iterator().next().tags().get("wtppjflcxogaoko")); - Assertions.assertEquals(SqlVersion.SQL_SERVER_2019, response.iterator().next().properties().version()); - Assertions.assertEquals(EditionType.DEVELOPER, response.iterator().next().properties().edition()); - Assertions.assertEquals("r", response.iterator().next().properties().containerResourceId()); - Assertions.assertEquals("mdnbbglzpswiy", response.iterator().next().properties().vCore()); - Assertions.assertEquals(ConnectionStatus.CONNECTED, response.iterator().next().properties().status()); - Assertions.assertEquals("wyhzdx", response.iterator().next().properties().patchLevel()); - Assertions.assertEquals("adbzmnvdfznud", response.iterator().next().properties().collation()); - Assertions.assertEquals("dvxzbncblylpst", response.iterator().next().properties().currentVersion()); - Assertions.assertEquals("hh", response.iterator().next().properties().instanceName()); - Assertions.assertEquals("rzdzucerscdnt", response.iterator().next().properties().tcpDynamicPorts()); - Assertions.assertEquals("vfiwjmygtdss", response.iterator().next().properties().tcpStaticPorts()); - Assertions.assertEquals("wtmwerio", response.iterator().next().properties().productId()); - Assertions.assertEquals(ArcSqlServerLicenseType.PAID, response.iterator().next().properties().licenseType()); - Assertions - .assertEquals( - OffsetDateTime.parse("2021-06-08T10:58:30Z"), - response.iterator().next().properties().azureDefenderStatusLastUpdated()); - Assertions - .assertEquals(DefenderStatus.UNPROTECTED, response.iterator().next().properties().azureDefenderStatus()); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/UploadWatermarkTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/UploadWatermarkTests.java deleted file mode 100644 index 3d2d1a3a08f9..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/UploadWatermarkTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.UploadWatermark; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class UploadWatermarkTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UploadWatermark model = - BinaryData - .fromString( - "{\"metrics\":\"2021-10-25T12:28:17Z\",\"logs\":\"2021-10-31T17:40:20Z\",\"usages\":\"2021-09-30T03:16:16Z\"}") - .toObject(UploadWatermark.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-25T12:28:17Z"), model.metrics()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-31T17:40:20Z"), model.logs()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-30T03:16:16Z"), model.usages()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UploadWatermark model = - new UploadWatermark() - .withMetrics(OffsetDateTime.parse("2021-10-25T12:28:17Z")) - .withLogs(OffsetDateTime.parse("2021-10-31T17:40:20Z")) - .withUsages(OffsetDateTime.parse("2021-09-30T03:16:16Z")); - model = BinaryData.fromObject(model).toObject(UploadWatermark.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-25T12:28:17Z"), model.metrics()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-31T17:40:20Z"), model.logs()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-30T03:16:16Z"), model.usages()); - } -}