diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/CHANGELOG.md b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/CHANGELOG.md index 77eda3362cc6..f1a7e1bd4848 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 (2023-06-12) + +- 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-2023-01. 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..32cf26cb34d8 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-2023-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -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}) diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/SAMPLE.md b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/SAMPLE.md index 7d1dcbc9f4fa..fad9861b3aae 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,6 +46,14 @@ - [ListByResourceGroup](#sqlmanagedinstances_listbyresourcegroup) - [Update](#sqlmanagedinstances_update) +## SqlServerDatabases + +- [Create](#sqlserverdatabases_create) +- [Delete](#sqlserverdatabases_delete) +- [Get](#sqlserverdatabases_get) +- [List](#sqlserverdatabases_list) +- [Update](#sqlserverdatabases_update) + ## SqlServerInstances - [Create](#sqlserverinstances_create) @@ -31,13 +62,134 @@ - [List](#sqlserverinstances_list) - [ListByResourceGroup](#sqlserverinstances_listbyresourcegroup) - [Update](#sqlserverinstances_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/2023-01-15-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/2023-01-15-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/2023-01-15-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/2023-01-15-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. */ 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/2023-01-15-preview/examples/DeleteDataController.json */ /** * Sample code: Delete a dataController. @@ -56,7 +208,7 @@ public final class DataControllersDeleteSamples { /** 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/2023-01-15-preview/examples/GetDataController.json */ /** * Sample code: Get a data controller. @@ -77,7 +229,7 @@ public final class DataControllersGetByResourceGroupSamples { /** 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/2023-01-15-preview/examples/ListSubscriptionDataController.json */ /** * Sample code: Gets all dataControllers in a subscription. @@ -97,7 +249,7 @@ public final class DataControllersListSamples { /** 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/2023-01-15-preview/examples/ListByResourceGroupDataController.json */ /** * Sample code: Gets all dataControllers in a resource group. @@ -121,7 +273,7 @@ import java.util.Map; /** 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/2023-01-15-preview/examples/UpdateDataController.json */ /** * Sample code: Updates a dataController tags. @@ -170,7 +322,7 @@ import java.util.UUID; /** 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/2023-01-15-preview/examples/CreateOrUpdateDataController.json */ /** * Sample code: Create or update a Data Controller. @@ -198,6 +350,10 @@ public final class DataControllersPutDataControllerSamples { .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")) @@ -234,13 +390,130 @@ public final class DataControllersPutDataControllerSamples { } ``` +### 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/2023-01-15-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(); + } + + @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_Delete + +```java +/** Samples for FailoverGroups Delete. */ +public final class FailoverGroupsDeleteSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-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/2023-01-15-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/2023-01-15-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. */ 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/2023-01-15-preview/examples/ListOperation.json */ /** * Sample code: Lists all of the available Azure Data Services on Azure Arc API operations. @@ -254,28 +527,215 @@ 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/2023-01-15-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/2023-01-15-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/2023-01-15-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/2023-01-15-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/2023-01-15-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/2023-01-15-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(); + } + + @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. */ 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/2023-01-15-preview/examples/CreateOrUpdateSqlManagedInstance.json */ /** * Sample code: Create or update a SQL Managed Instance. @@ -324,10 +784,41 @@ public final class SqlManagedInstancesCreateSamples { .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") @@ -362,7 +853,7 @@ public final class SqlManagedInstancesCreateSamples { /** 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/2023-01-15-preview/examples/DeleteSqlManagedInstance.json */ /** * Sample code: Delete a SQL Instance. @@ -381,7 +872,7 @@ public final class SqlManagedInstancesDeleteSamples { /** 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/2023-01-15-preview/examples/GetSqlManagedInstance.json */ /** * Sample code: Updates a SQL Instance tags. @@ -402,7 +893,7 @@ public final class SqlManagedInstancesGetByResourceGroupSamples { /** 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/2023-01-15-preview/examples/ListSubscriptionSqlManagedInstance.json */ /** * Sample code: Gets all SQL Instance in a subscription. @@ -422,7 +913,7 @@ public final class SqlManagedInstancesListSamples { /** 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/2023-01-15-preview/examples/ListByResourceGroupSqlManagedInstance.json */ /** * Sample code: Gets all SQL Instance in a resource group. @@ -446,7 +937,7 @@ import java.util.Map; /** 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/2023-01-15-preview/examples/UpdateSqlManagedInstance.json */ /** * Sample code: Updates a sql Instance tags. @@ -475,6 +966,177 @@ public final class SqlManagedInstancesUpdateSamples { } ``` +### SqlServerDatabases_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.DatabaseState; +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/2023-01-15-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")))) + .withTags(mapOf("mytag", "myval")) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlServerDatabases_Delete + +```java +/** Samples for SqlServerDatabases Delete. */ +public final class SqlServerDatabasesDeleteSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-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() + .deleteWithResponse("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/2023-01-15-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/2023-01-15-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/2023-01-15-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(); + } + + @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 @@ -482,6 +1144,7 @@ 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.HostType; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties; import com.azure.resourcemanager.azurearcdata.models.SqlVersion; import java.time.OffsetDateTime; @@ -491,7 +1154,7 @@ import java.util.Map; /** 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/2023-01-15-preview/examples/CreateOrUpdateSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. @@ -508,21 +1171,23 @@ public final class SqlServerInstancesCreateSamples { .withTags(mapOf("mytag", "myval")) .withProperties( new SqlServerInstanceProperties() - .withVersion(SqlVersion.SQL_SERVER_2017) + .withVersion(SqlVersion.SQL_SERVER_2012) .withEdition(EditionType.DEVELOPER) - .withContainerResourceId("Arc Machine Name") + .withContainerResourceId("Resource id of hosting Arc Machine") .withVCore("4") - .withStatus(ConnectionStatus.CONNECTED) + .withCores("4") + .withStatus(ConnectionStatus.REGISTERED) .withPatchLevel("patchlevel") .withCollation("collation") - .withCurrentVersion("2008 R2") + .withCurrentVersion("2012") .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)) + .withAzureDefenderStatus(DefenderStatus.PROTECTED) + .withHostType(HostType.PHYSICAL_SERVER)) .create(); } @@ -545,7 +1210,7 @@ public final class SqlServerInstancesCreateSamples { /** 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/2023-01-15-preview/examples/DeleteSqlServerInstance.json */ /** * Sample code: Delete a SQL Server Instance. @@ -564,7 +1229,7 @@ public final class SqlServerInstancesDeleteSamples { /** 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/2023-01-15-preview/examples/GetSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. @@ -586,7 +1251,7 @@ public final class SqlServerInstancesGetByResourceGroupSamples { /** 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/2023-01-15-preview/examples/ListSubscriptionSqlServerInstance.json */ /** * Sample code: Gets all SQL Server Instance in a subscription. @@ -606,7 +1271,7 @@ public final class SqlServerInstancesListSamples { /** 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/2023-01-15-preview/examples/ListByResourceGroupSqlServerInstance.json */ /** * Sample code: Gets all SQL Server Instance in a resource group. @@ -630,7 +1295,7 @@ import java.util.Map; /** 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/2023-01-15-preview/examples/UpdateSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/pom.xml b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/pom.xml index 3d1f2c5ba4d2..925910cea3ac 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-2023-01. https://github.com/Azure/azure-sdk-for-java @@ -38,7 +43,8 @@ UTF-8 - true + 0 + 0 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..8c826d12b084 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,14 +24,22 @@ 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.SqlServerDatabasesImpl; import com.azure.resourcemanager.azurearcdata.implementation.SqlServerInstancesImpl; +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.SqlServerDatabases; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstances; import java.time.Duration; import java.time.temporal.ChronoUnit; @@ -49,10 +57,18 @@ public final class AzureArcDataManager { private SqlManagedInstances sqlManagedInstances; + private FailoverGroups failoverGroups; + private SqlServerInstances sqlServerInstances; private DataControllers dataControllers; + private ActiveDirectoryConnectors activeDirectoryConnectors; + + private PostgresInstances postgresInstances; + + private SqlServerDatabases sqlServerDatabases; + private final AzureArcDataManagementClient clientObject; private AzureArcDataManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -218,7 +234,7 @@ public AzureArcDataManager authenticate(TokenCredential credential, AzureProfile .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(" (") @@ -299,6 +315,18 @@ 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. * @@ -323,6 +351,43 @@ public DataControllers dataControllers() { return dataControllers; } + /** + * 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 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; + } + /** * @return Wrapped service client AzureArcDataManagementClient providing direct access to the underlying * auto-generated API implementation, based on Azure REST API. 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..9ff9ecf9e920 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/ActiveDirectoryConnectorsClient.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.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..87899917a44a 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 @@ -58,6 +58,13 @@ public interface AzureArcDataManagementClient { */ SqlManagedInstancesClient getSqlManagedInstances(); + /** + * Gets the FailoverGroupsClient object to access its operations. + * + * @return the FailoverGroupsClient object. + */ + FailoverGroupsClient getFailoverGroups(); + /** * Gets the SqlServerInstancesClient object to access its operations. * @@ -71,4 +78,25 @@ public interface AzureArcDataManagementClient { * @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 SqlServerDatabasesClient object to access its operations. + * + * @return the SqlServerDatabasesClient object. + */ + SqlServerDatabasesClient getSqlServerDatabases(); } 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..dcbaee8c705b 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 @@ -21,7 +21,7 @@ public interface DataControllersClient { * * @throws com.azure.core.management.exception.ManagementException 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(); @@ -33,7 +33,7 @@ public interface DataControllersClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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); @@ -45,7 +45,7 @@ public interface DataControllersClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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); @@ -58,7 +58,7 @@ public interface DataControllersClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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); @@ -67,7 +67,7 @@ public interface DataControllersClient { * 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. @@ -82,7 +82,7 @@ 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. @@ -101,7 +101,7 @@ 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -116,7 +116,7 @@ DataControllerResourceInner putDataController( * 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. @@ -135,7 +135,7 @@ 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -148,7 +148,7 @@ 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. @@ -163,7 +163,7 @@ 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -175,7 +175,7 @@ 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. @@ -188,7 +188,7 @@ 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. @@ -203,7 +203,7 @@ Response getByResourceGroupWithResponse( * 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. @@ -216,16 +216,31 @@ Response getByResourceGroupWithResponse( * 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. + * @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 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( + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DataControllerResourceInner> beginPatchDataController( String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource, @@ -235,7 +250,7 @@ Response patchDataControllerWithResponse( * 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. @@ -245,4 +260,23 @@ Response patchDataControllerWithResponse( @ServiceMethod(returns = ReturnType.SINGLE) 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..966e97fb4a67 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/FailoverGroupsClient.java @@ -0,0 +1,213 @@ +// Copyright (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/PostgresInstancesClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/PostgresInstancesClient.java new file mode 100644 index 000000000000..238a96a36109 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/PostgresInstancesClient.java @@ -0,0 +1,242 @@ +// Copyright (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..ef7de143d658 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 @@ -99,7 +99,7 @@ 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. @@ -114,7 +114,7 @@ SyncPoller, SqlManagedInstanceInner> beginCr * 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. @@ -133,7 +133,7 @@ SyncPoller, SqlManagedInstanceInner> beginCr * 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. @@ -148,7 +148,7 @@ SqlManagedInstanceInner create( * 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. @@ -167,7 +167,7 @@ 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -180,7 +180,7 @@ 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. @@ -195,7 +195,7 @@ 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -207,7 +207,7 @@ 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. @@ -220,7 +220,7 @@ 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. @@ -236,7 +236,7 @@ Response updateWithResponse( * 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. 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..75c5aae7591d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerDatabasesClient.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.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.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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 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); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 updateWithResponse( + 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); + + /** + * 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/SqlServerInstancesClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerInstancesClient.java index 9bcffa5af944..961c481412a4 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 @@ -99,7 +99,7 @@ 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. @@ -114,7 +114,7 @@ SyncPoller, SqlServerInstanceInner> beginCrea * 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. @@ -133,7 +133,7 @@ SyncPoller, SqlServerInstanceInner> beginCrea * 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. @@ -148,7 +148,7 @@ SqlServerInstanceInner create( * 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. @@ -167,7 +167,7 @@ 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -180,7 +180,7 @@ 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. @@ -195,7 +195,7 @@ 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -207,7 +207,7 @@ 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. @@ -220,7 +220,7 @@ SyncPoller, Void> beginDelete( * 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. @@ -236,7 +236,7 @@ Response updateWithResponse( * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. 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..040f024a5515 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/ActiveDirectoryConnectorResourceInner.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Active directory connector resource. */ +@Fluent +public final class ActiveDirectoryConnectorResourceInner extends ProxyResource { + /* + * null + */ + @JsonProperty(value = "properties", required = true) + private ActiveDirectoryConnectorProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** 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; + } + + /** + * 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 ActiveDirectoryConnectorResourceInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActiveDirectoryConnectorResourceInner.class); +} 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..17b7eedbd88c 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 @@ -29,7 +29,7 @@ public final class DataControllerResourceInner extends Resource { 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; @@ -79,7 +79,7 @@ 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. */ 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..6be4f37fc2cb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/FailoverGroupResourceInner.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.resourcemanager.azurearcdata.models.FailoverGroupProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A failover group resource. */ +@Fluent +public final class FailoverGroupResourceInner extends ProxyResource { + /* + * null + */ + @JsonProperty(value = "properties", required = true) + private FailoverGroupProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** 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; + } + + /** + * 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 FailoverGroupResourceInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FailoverGroupResourceInner.class); +} 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..20211e35ae36 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/PostgresInstanceInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceProperties; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A Postgres Instance. */ +@Fluent +public final class PostgresInstanceInner extends Resource { + /* + * The extendedLocation of the resource. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /* + * null + */ + @JsonProperty(value = "properties", required = true) + private PostgresInstanceProperties properties; + + /* + * Resource sku. + */ + @JsonProperty(value = "sku") + private PostgresInstanceSku sku; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** 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; + } + + /** {@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 + .logExceptionAsError( + 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); +} 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..8a61124095f7 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 @@ -36,7 +36,7 @@ public final class SqlManagedInstanceInner extends Resource { 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; @@ -106,7 +106,7 @@ 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. */ 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..454f43305d47 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerDatabaseResourceInner.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.resourcemanager.azurearcdata.models.SqlServerDatabaseResourceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Arc Sql Server database. */ +@Fluent +public final class SqlServerDatabaseResourceInner extends Resource { + /* + * Properties of Arc Sql Server database + */ + @JsonProperty(value = "properties", required = true) + private SqlServerDatabaseResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** 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; + } + + /** {@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 + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property properties in model SqlServerDatabaseResourceInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlServerDatabaseResourceInner.class); +} 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..58e589c096ca 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 @@ -21,7 +21,7 @@ public final class SqlServerInstanceInner extends Resource { 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; @@ -51,7 +51,7 @@ 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. */ 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..7aa76cbf5726 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorResourceImpl.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.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..a96451eb569b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsClientImpl.java @@ -0,0 +1,1207 @@ +// Copyright (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 + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory 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 + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory 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..2fe937c8e39d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 Utils.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 Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dataControllerName = Utils.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 = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dataControllerName = Utils.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 = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dataControllerName = Utils.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 = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dataControllerName = Utils.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 = Utils.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/AzureArcDataManagementClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientImpl.java index d26c401a6926..d35be2240b9a 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 @@ -22,10 +22,14 @@ 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.SqlServerDatabasesClient; import com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient; import java.io.IOException; import java.lang.reflect.Type; @@ -135,6 +139,18 @@ public SqlManagedInstancesClient getSqlManagedInstances() { return this.sqlManagedInstances; } + /** 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; @@ -159,6 +175,42 @@ 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 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; + } + /** * Initializes an instance of AzureArcDataManagementClient client. * @@ -181,11 +233,15 @@ public DataControllersClient getDataControllers() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2021-08-01"; + this.apiVersion = "2023-01-15-preview"; this.operations = new OperationsClientImpl(this); this.sqlManagedInstances = new SqlManagedInstancesClientImpl(this); + this.failoverGroups = new FailoverGroupsClientImpl(this); this.sqlServerInstances = new SqlServerInstancesClientImpl(this); this.dataControllers = new DataControllersClientImpl(this); + this.activeDirectoryConnectors = new ActiveDirectoryConnectorsClientImpl(this); + this.postgresInstances = new PostgresInstancesClientImpl(this); + this.sqlServerDatabases = new SqlServerDatabasesClientImpl(this); } /** 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..3c4b20abbc5c 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 @@ -123,9 +123,7 @@ public DataControllerResource apply() { serviceManager .serviceClient() .getDataControllers() - .patchDataControllerWithResponse( - resourceGroupName, dataControllerName, updateDataControllerResource, Context.NONE) - .getValue(); + .patchDataController(resourceGroupName, dataControllerName, updateDataControllerResource, Context.NONE); return this; } @@ -134,9 +132,7 @@ public DataControllerResource apply(Context context) { serviceManager .serviceClient() .getDataControllers() - .patchDataControllerWithResponse( - resourceGroupName, dataControllerName, updateDataControllerResource, context) - .getValue(); + .patchDataController(resourceGroupName, dataControllerName, updateDataControllerResource, context); return this; } @@ -180,8 +176,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..8b813e422b62 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 @@ -79,8 +79,7 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/dataControllers") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroup( @@ -93,8 +92,7 @@ Mono> listByResourceGroup( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/dataControllers/{dataControllerName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") @ExpectedResponses({200, 201}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> putDataController( @@ -109,8 +107,7 @@ Mono>> putDataController( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/dataControllers/{dataControllerName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") @ExpectedResponses({200, 202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -124,8 +121,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/dataControllers/{dataControllerName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> getByResourceGroup( @@ -139,11 +135,10 @@ Mono> getByResourceGroup( @Headers({"Content-Type: application/json"}) @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/dataControllers/{dataControllerName}") - @ExpectedResponses({200}) + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") + @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> patchDataController( + Mono>> patchDataController( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @@ -179,7 +174,7 @@ Mono> listInGroupNext( * * @throws ManagementException 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() { @@ -225,7 +220,7 @@ private Mono> listSinglePageAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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) { @@ -266,7 +261,7 @@ private Mono> listSinglePageAsync(Con * * @throws ManagementException 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() { @@ -281,7 +276,7 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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) { @@ -294,7 +289,7 @@ private PagedFlux listAsync(Context context) { * * @throws ManagementException 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() { @@ -308,7 +303,7 @@ public PagedIterable list() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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) { @@ -322,7 +317,7 @@ public PagedIterable list(Context context) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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( @@ -375,7 +370,7 @@ private Mono> listByResourceGroupSing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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( @@ -424,7 +419,7 @@ private Mono> listByResourceGroupSing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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) { @@ -441,7 +436,7 @@ private PagedFlux listByResourceGroupAsync(String r * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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) { @@ -457,7 +452,7 @@ private PagedFlux listByResourceGroupAsync(String r * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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) { @@ -472,7 +467,7 @@ public PagedIterable listByResourceGroup(String res * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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) { @@ -483,7 +478,7 @@ 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. @@ -541,7 +536,7 @@ private Mono>> putDataControllerWithResponseAsync( * 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. @@ -600,7 +595,7 @@ private Mono>> putDataControllerWithResponseAsync( * 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. @@ -627,7 +622,7 @@ private Mono>> putDataControllerWithResponseAsync( * 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. @@ -659,7 +654,7 @@ private Mono>> putDataControllerWithResponseAsync( * 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. @@ -678,7 +673,7 @@ public SyncPoller, DataControllerResourc * 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. @@ -701,7 +696,7 @@ public SyncPoller, DataControllerResourc * 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. @@ -720,7 +715,7 @@ 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. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -743,7 +738,7 @@ 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. @@ -760,7 +755,7 @@ public DataControllerResourceInner putDataController( * 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. @@ -781,7 +776,7 @@ public 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -830,7 +825,7 @@ private Mono>> deleteWithResponseAsync( * 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. @@ -877,7 +872,7 @@ private Mono>> deleteWithResponseAsync( * 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. @@ -896,7 +891,7 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * 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. @@ -917,7 +912,7 @@ private PollerFlux, Void> beginDeleteAsync( * 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. @@ -932,7 +927,7 @@ 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. @@ -949,7 +944,7 @@ public 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -966,7 +961,7 @@ private Mono deleteAsync(String resourceGroupName, String dataControllerNa * 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. @@ -984,7 +979,7 @@ private Mono deleteAsync(String resourceGroupName, String dataControllerNa * 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. @@ -998,7 +993,7 @@ 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. @@ -1013,7 +1008,7 @@ 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. @@ -1062,7 +1057,7 @@ private Mono> getByResourceGroupWithRespon * 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. @@ -1109,7 +1104,7 @@ private Mono> getByResourceGroupWithRespon * 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. @@ -1126,7 +1121,7 @@ private Mono getByResourceGroupAsync( * 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. @@ -1143,7 +1138,7 @@ public Response getByResourceGroupWithResponse( * 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. @@ -1158,7 +1153,7 @@ 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,7 +1161,7 @@ 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( + private Mono>> patchDataControllerWithResponseAsync( String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource) { if (this.client.getEndpoint() == null) { return Mono @@ -1216,7 +1211,7 @@ private Mono> patchDataControllerWithRespo * 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,7 +1220,7 @@ private Mono> patchDataControllerWithRespo * @return data controller resource along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> patchDataControllerWithResponseAsync( + private Mono>> patchDataControllerWithResponseAsync( String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource, @@ -1275,7 +1270,109 @@ private Mono> patchDataControllerWithRespo * 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. + * @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 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. @@ -1285,38 +1382,39 @@ private Mono> patchDataControllerWithRespo @ServiceMethod(returns = ReturnType.SINGLE) private Mono patchDataControllerAsync( String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource) { - return patchDataControllerWithResponseAsync(resourceGroupName, dataControllerName, dataControllerResource) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + 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( + private Mono patchDataControllerAsync( String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource, Context context) { - return patchDataControllerWithResponseAsync( - resourceGroupName, dataControllerName, dataControllerResource, context) - .block(); + 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. @@ -1326,9 +1424,28 @@ public Response patchDataControllerWithResponse( @ServiceMethod(returns = ReturnType.SINGLE) public DataControllerResourceInner patchDataController( String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource) { - return patchDataControllerWithResponse( - resourceGroupName, dataControllerName, dataControllerResource, Context.NONE) - .getValue(); + 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(); } /** @@ -1339,7 +1456,7 @@ public DataControllerResourceInner patchDataController( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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) { @@ -1377,7 +1494,7 @@ private Mono> listInSubscriptionNextS * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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( @@ -1414,7 +1531,7 @@ private Mono> listInSubscriptionNextS * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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) { @@ -1451,7 +1568,7 @@ private Mono> listInGroupNextSinglePa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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( 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..425ef06b1523 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupResourceImpl.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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..cfad77e3a460 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsClientImpl.java @@ -0,0 +1,1160 @@ +// Copyright (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 + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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 + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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..d34af2f19d75 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsImpl.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 Utils.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 Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlManagedInstanceName = Utils.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 = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlManagedInstanceName = Utils.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 = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlManagedInstanceName = Utils.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 = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlManagedInstanceName = Utils.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 = Utils.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/PostgresInstanceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstanceImpl.java new file mode 100644 index 000000000000..9bba9cfb508a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstanceImpl.java @@ -0,0 +1,217 @@ +// Copyright (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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.postgresInstanceName = Utils.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..2d0afab2b1ae --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesClientImpl.java @@ -0,0 +1,1445 @@ +// Copyright (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 + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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 + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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 + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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 + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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..d2a6f908ce67 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesImpl.java @@ -0,0 +1,179 @@ +// Copyright (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 Utils.mapPage(inner, inner1 -> new PostgresInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new PostgresInstanceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new PostgresInstanceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String postgresInstanceName = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String postgresInstanceName = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String postgresInstanceName = Utils.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 = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String postgresInstanceName = Utils.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/SqlManagedInstancesClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesClientImpl.java index c79940fd8b3c..0fee021c52db 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 @@ -79,8 +79,7 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlManagedInstances") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroup( @@ -93,8 +92,7 @@ Mono> listByResourceGroup( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlManagedInstances/{sqlManagedInstanceName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> getByResourceGroup( @@ -108,8 +106,7 @@ Mono> getByResourceGroup( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlManagedInstances/{sqlManagedInstanceName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") @ExpectedResponses({200, 201}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -124,8 +121,7 @@ Mono>> create( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlManagedInstances/{sqlManagedInstanceName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") @ExpectedResponses({200, 202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -139,8 +135,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlManagedInstances/{sqlManagedInstanceName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> update( @@ -642,7 +637,7 @@ 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. @@ -700,7 +695,7 @@ private Mono>> createWithResponseAsync( * 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. @@ -759,7 +754,7 @@ private Mono>> createWithResponseAsync( * 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. @@ -785,7 +780,7 @@ private PollerFlux, 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. @@ -816,7 +811,7 @@ private PollerFlux, 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -833,7 +828,7 @@ 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. @@ -856,7 +851,7 @@ 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -875,7 +870,7 @@ private Mono createAsync( * 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. @@ -898,7 +893,7 @@ private Mono createAsync( * 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. @@ -915,7 +910,7 @@ public SqlManagedInstanceInner create( * 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. @@ -936,7 +931,7 @@ public 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -986,7 +981,7 @@ private Mono>> deleteWithResponseAsync( * 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. @@ -1034,7 +1029,7 @@ private Mono>> deleteWithResponseAsync( * 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. @@ -1054,7 +1049,7 @@ private PollerFlux, Void> beginDeleteAsync( * 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. @@ -1076,7 +1071,7 @@ private PollerFlux, Void> beginDeleteAsync( * 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. @@ -1091,7 +1086,7 @@ 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. @@ -1108,7 +1103,7 @@ public 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1125,7 +1120,7 @@ private Mono deleteAsync(String resourceGroupName, String sqlManagedInstan * 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. @@ -1143,7 +1138,7 @@ private Mono deleteAsync(String resourceGroupName, String sqlManagedInstan * 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. @@ -1157,7 +1152,7 @@ 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. @@ -1172,7 +1167,7 @@ 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. @@ -1229,7 +1224,7 @@ private Mono> updateWithResponseAsync( * 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. @@ -1284,7 +1279,7 @@ private Mono> updateWithResponseAsync( * 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. @@ -1302,7 +1297,7 @@ private Mono updateAsync( * 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. @@ -1320,7 +1315,7 @@ public Response updateWithResponse( * 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. 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..7eb75fdf65ab --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabaseResourceImpl.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.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() + .updateWithResponse( + resourceGroupName, sqlServerInstanceName, databaseName, updateSqlServerDatabaseUpdate, Context.NONE) + .getValue(); + return this; + } + + public SqlServerDatabaseResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServerDatabases() + .updateWithResponse( + resourceGroupName, sqlServerInstanceName, databaseName, updateSqlServerDatabaseUpdate, context) + .getValue(); + return this; + } + + SqlServerDatabaseResourceImpl( + SqlServerDatabaseResourceInner 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.databaseName = Utils.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..600fb3df8524 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesClientImpl.java @@ -0,0 +1,1131 @@ +// Copyright (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.SqlServerDatabasesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerDatabaseResourceInner; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerDatabaseListResult; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseUpdate; +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}) + @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({200, 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}) + @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 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 deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName, databaseName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String sqlServerInstanceName, String databaseName, Context context) { + return deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName, databaseName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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) { + deleteWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, Context.NONE); + } + + /** + * 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 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 updateWithResponseAsync(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate) + .flatMap(res -> Mono.justOrEmpty(res.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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 updateWithResponse( + String resourceGroupName, + String sqlServerInstanceName, + String databaseName, + SqlServerDatabaseUpdate sqlServerDatabaseUpdate, + Context context) { + return updateWithResponseAsync( + resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate, context) + .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 updateWithResponse( + resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate, Context.NONE) + .getValue(); + } + + /** + * 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 + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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 + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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..0b8988ececb0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesImpl.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.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 Response deleteWithResponse( + String resourceGroupName, String sqlServerInstanceName, String databaseName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, context); + } + + public void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName) { + this.serviceClient().delete(resourceGroupName, sqlServerInstanceName, databaseName); + } + + 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 Utils.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 Utils.mapPage(inner, inner1 -> new SqlServerDatabaseResourceImpl(inner1, this.manager())); + } + + public SqlServerDatabaseResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerInstanceName = Utils.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 = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerInstanceName = Utils.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 = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerInstanceName = Utils.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 = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.deleteWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerInstanceName = Utils.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 = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.deleteWithResponse(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/SqlServerInstancesClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesClientImpl.java index 7776014f5219..8ec1e5c51ae6 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 @@ -79,8 +79,7 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlServerInstances") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroup( @@ -93,8 +92,7 @@ Mono> listByResourceGroup( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlServerInstances/{sqlServerInstanceName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> getByResourceGroup( @@ -108,8 +106,7 @@ Mono> getByResourceGroup( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlServerInstances/{sqlServerInstanceName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") @ExpectedResponses({200, 201}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -124,8 +121,7 @@ Mono>> create( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlServerInstances/{sqlServerInstanceName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") @ExpectedResponses({200, 202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -139,8 +135,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData" - + "/sqlServerInstances/{sqlServerInstanceName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> update( @@ -640,7 +635,7 @@ 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. @@ -697,7 +692,7 @@ private Mono>> createWithResponseAsync( * 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. @@ -755,7 +750,7 @@ private Mono>> createWithResponseAsync( * 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. @@ -781,7 +776,7 @@ private PollerFlux, SqlServerInstanceInner> b * 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. @@ -812,7 +807,7 @@ private PollerFlux, SqlServerInstanceInner> b * 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. @@ -829,7 +824,7 @@ public SyncPoller, SqlServerInstanceInner> be * 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. @@ -852,7 +847,7 @@ public SyncPoller, SqlServerInstanceInner> be * 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. @@ -871,7 +866,7 @@ private Mono createAsync( * 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. @@ -894,7 +889,7 @@ private Mono createAsync( * 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. @@ -911,7 +906,7 @@ public SqlServerInstanceInner create( * 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. @@ -932,7 +927,7 @@ public 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -981,7 +976,7 @@ private Mono>> deleteWithResponseAsync( * 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. @@ -1028,7 +1023,7 @@ private Mono>> deleteWithResponseAsync( * 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. @@ -1048,7 +1043,7 @@ private PollerFlux, Void> beginDeleteAsync( * 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. @@ -1070,7 +1065,7 @@ private PollerFlux, Void> beginDeleteAsync( * 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. @@ -1085,7 +1080,7 @@ 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. @@ -1102,7 +1097,7 @@ public 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1119,7 +1114,7 @@ private Mono deleteAsync(String resourceGroupName, String sqlServerInstanc * 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. @@ -1137,7 +1132,7 @@ private Mono deleteAsync(String resourceGroupName, String sqlServerInstanc * 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. @@ -1151,7 +1146,7 @@ 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. @@ -1166,7 +1161,7 @@ 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. @@ -1222,7 +1217,7 @@ private Mono> updateWithResponseAsync( * 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. @@ -1276,7 +1271,7 @@ private Mono> updateWithResponseAsync( * 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. @@ -1294,7 +1289,7 @@ private Mono updateAsync( * 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. @@ -1312,7 +1307,7 @@ public Response updateWithResponse( * 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. 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..dc242590023a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AccountProvisioningMode.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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/ActiveDirectoryConnectorDnsDetails.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDnsDetails.java new file mode 100644 index 000000000000..d65217ffc9c7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDnsDetails.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** DNS server details. */ +@Fluent +public final class ActiveDirectoryConnectorDnsDetails { + /* + * DNS domain name for which DNS lookups should be forwarded to the Active Directory DNS servers. + */ + @JsonProperty(value = "domainName") + private String domainName; + + /* + * List of Active Directory DNS server IP addresses. + */ + @JsonProperty(value = "nameserverIPAddresses", required = true) + private List nameserverIpAddresses; + + /* + * Replica count for DNS proxy service. Default value is 1. + */ + @JsonProperty(value = "replicas") + private Long replicas; + + /* + * Flag indicating whether to prefer Kubernetes DNS server response over AD DNS server response for IP address + * lookups. + */ + @JsonProperty(value = "preferK8sDnsForPtrLookups") + 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 + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property nameserverIpAddresses in model ActiveDirectoryConnectorDnsDetails")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActiveDirectoryConnectorDnsDetails.class); +} 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..cafb2ba7ae51 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDomainDetails.java @@ -0,0 +1,172 @@ +// Copyright (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.fasterxml.jackson.annotation.JsonProperty; + +/** Active Directory domain details. */ +@Fluent +public final class ActiveDirectoryConnectorDomainDetails { + /* + * Name (uppercase) of the Active Directory domain that this AD connector will be associated with. + */ + @JsonProperty(value = "realm", required = true) + private String realm; + + /* + * NETBIOS name of the Active Directory domain. + */ + @JsonProperty(value = "netbiosDomainName") + private String netbiosDomainName; + + /* + * The service account provisioning mode for this Active Directory connector. + */ + @JsonProperty(value = "serviceAccountProvisioning") + private AccountProvisioningMode serviceAccountProvisioning; + + /* + * The distinguished name of the Active Directory Organizational Unit. + */ + @JsonProperty(value = "ouDistinguishedName") + private String ouDistinguishedName; + + /* + * null + */ + @JsonProperty(value = "domainControllers") + 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 + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property realm in model ActiveDirectoryConnectorDomainDetails")); + } + if (domainControllers() != null) { + domainControllers().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActiveDirectoryConnectorDomainDetails.class); +} 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..17b8e175b009 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorListResult.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; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.azurearcdata.fluent.models.ActiveDirectoryConnectorResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of active directory connectors. */ +@Immutable +public final class ActiveDirectoryConnectorListResult { + /* + * 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 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()); + } + } +} 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..166e995ab20c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorProperties.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.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Active Directory connector resource. */ +@Fluent +public final class ActiveDirectoryConnectorProperties { + /* + * Username and password for domain service account authentication. + */ + @JsonProperty(value = "domainServiceAccountLoginInformation") + private BasicLoginInformation domainServiceAccountLoginInformation; + + /* + * The provisioning state of the Active Directory connector resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * null + */ + @JsonProperty(value = "spec", required = true) + private ActiveDirectoryConnectorSpec spec; + + /* + * null + */ + @JsonProperty(value = "status") + 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 + .logExceptionAsError( + 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); +} 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..c57003e90a4c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorResource.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.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..0664f57dd512 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorSpec.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.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The specifications of the AD Kubernetes resource. */ +@Fluent +public final class ActiveDirectoryConnectorSpec { + /* + * null + */ + @JsonProperty(value = "activeDirectory", required = true) + private ActiveDirectoryConnectorDomainDetails activeDirectory; + + /* + * null + */ + @JsonProperty(value = "dns", required = true) + 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 + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property activeDirectory in model ActiveDirectoryConnectorSpec")); + } else { + activeDirectory().validate(); + } + if (dns() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property dns in model ActiveDirectoryConnectorSpec")); + } else { + dns().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActiveDirectoryConnectorSpec.class); +} 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..1cfb32dabdb4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorStatus.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 java.util.Map; + +/** The status of the Kubernetes custom resource. */ +@Fluent +public final class ActiveDirectoryConnectorStatus { + /* + * The time that the custom resource was last updated. + */ + @JsonProperty(value = "lastUpdateTime") + private String lastUpdateTime; + + /* + * The version of the replicaSet associated with the AD connector custom resource. + */ + @JsonProperty(value = "observedGeneration") + private Long observedGeneration; + + /* + * The state of the AD connector custom resource. + */ + @JsonProperty(value = "state") + private String state; + + /* + * The status of the Kubernetes custom resource. + */ + @JsonIgnore 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. + */ + @JsonAnyGetter + 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; + } + + @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() { + } +} 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..c8b70e4a3661 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectors.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 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..08600edda0a2 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainController.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; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about a domain controller in the AD domain. */ +@Fluent +public final class ActiveDirectoryDomainController { + /* + * Fully-qualified domain name of a domain controller in the AD domain. + */ + @JsonProperty(value = "hostname", required = true) + 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 + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property hostname in model ActiveDirectoryDomainController")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActiveDirectoryDomainController.class); +} 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..bff848a0e61b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainControllers.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Details about the Active Directory domain controllers associated with this AD connector instance. */ +@Fluent +public final class ActiveDirectoryDomainControllers { + /* + * Information about the Primary Domain Controller (PDC) in the AD domain. + */ + @JsonProperty(value = "primaryDomainController") + private ActiveDirectoryDomainController primaryDomainController; + + /* + * null + */ + @JsonProperty(value = "secondaryDomainControllers") + 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()); + } + } +} 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..e8781c586f87 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryInformation.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Active Directory information that related to the resource. */ +@Fluent +public final class ActiveDirectoryInformation { + /* + * Keytab information that is used for the Sql Managed Instance when Active Directory authentication is used. + */ + @JsonProperty(value = "keytabInformation") + 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(); + } + } +} 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..59c8c1e32820 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,47 @@ package com.azure.resourcemanager.azurearcdata.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** The license type to apply for this managed instance. */ -public enum ArcSqlManagedInstanceLicenseType { - /** Enum value BasePrice. */ - BASE_PRICE("BasePrice"), +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. + * Creates or finds a ArcSqlManagedInstanceLicenseType from its string representation. * - * @param value the serialized value to parse. - * @return the parsed ArcSqlManagedInstanceLicenseType object, or null if unable to parse. + * @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/ArcSqlServerDatabaseListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerDatabaseListResult.java new file mode 100644 index 000000000000..30588805804c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerDatabaseListResult.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; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerDatabaseResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Arc Sql Server database. */ +@Immutable +public final class ArcSqlServerDatabaseListResult { + /* + * Array of Arc Sql Server database. + */ + @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 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()); + } + } +} 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..0a17bae32ee2 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 @@ -10,8 +10,8 @@ /** 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. */ public static final ArcSqlServerLicenseType FREE = fromString("Free"); @@ -19,8 +19,17 @@ public final class ArcSqlServerLicenseType extends ExpandableStringEnum 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. 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..867519ef9b1f 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 @@ -19,6 +19,12 @@ public final class DataControllerUpdate { @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; + /* + * The data controller's properties + */ + @JsonProperty(value = "properties") + private DataControllerProperties properties; + /** Creates an instance of DataControllerUpdate class. */ public DataControllerUpdate() { } @@ -43,11 +49,34 @@ 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(); + } } } 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..ffea161bb378 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 @@ -15,7 +15,7 @@ public interface DataControllers { * * @throws com.azure.core.management.exception.ManagementException 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(); @@ -26,7 +26,7 @@ public interface DataControllers { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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); @@ -37,7 +37,7 @@ public interface DataControllers { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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); @@ -49,7 +49,7 @@ public interface DataControllers { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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); @@ -57,7 +57,7 @@ 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -68,7 +68,7 @@ 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. @@ -80,7 +80,7 @@ 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. @@ -94,7 +94,7 @@ Response getByResourceGroupWithResponse( * 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. 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..6fcbc8f2e35e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseState.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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/EditionType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EditionType.java index fa05fa3f67f8..0e282faea62c 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 @@ -28,6 +28,9 @@ public final class EditionType extends ExpandableStringEnum { /** 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. * 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..99415cabb709 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupListResult.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; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.azurearcdata.fluent.models.FailoverGroupResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of failover groups. */ +@Immutable +public final class FailoverGroupListResult { + /* + * Array of failover group 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 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()); + } + } +} 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..977a90c9b56c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupPartnerSyncMode.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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..77bf337c07af --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupProperties.java @@ -0,0 +1,172 @@ +// Copyright (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.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 java.util.Map; + +/** The properties of a failover group resource. */ +@Fluent +public final class FailoverGroupProperties { + /* + * The provisioning state of the failover group resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The resource ID of the partner SQL managed instance. + */ + @JsonProperty(value = "partnerManagedInstanceId", required = true) + private String partnerManagedInstanceId; + + /* + * The specifications of the failover group resource. + */ + @JsonProperty(value = "spec", required = true) + private FailoverGroupSpec spec; + + /* + * The status of the failover group custom resource. + */ + @JsonProperty(value = "status") + private Object status; + + /* + * The properties of a failover group resource. + */ + @JsonIgnore 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. + */ + @JsonAnyGetter + 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; + } + + @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 (partnerManagedInstanceId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property partnerManagedInstanceId in model FailoverGroupProperties")); + } + if (spec() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property spec in model FailoverGroupProperties")); + } else { + spec().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FailoverGroupProperties.class); +} 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..0b7bf2fb21de --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupResource.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.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..c92fa5d49599 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupSpec.java @@ -0,0 +1,258 @@ +// Copyright (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.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 java.util.Map; + +/** The specifications of the failover group resource. */ +@Fluent +public final class FailoverGroupSpec { + /* + * 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. + */ + @JsonProperty(value = "sharedName") + private String sharedName; + + /* + * The name of the SQL managed instance with this failover group role. + */ + @JsonProperty(value = "sourceMI") + private String sourceMI; + + /* + * The name of the partner SQL managed instance. + */ + @JsonProperty(value = "partnerMI") + private String partnerMI; + + /* + * The mirroring endpoint URL of the partner SQL managed instance. + */ + @JsonProperty(value = "partnerMirroringURL") + private String partnerMirroringUrl; + + /* + * The mirroring endpoint public certificate for the partner SQL managed instance. Only PEM format is supported. + */ + @JsonProperty(value = "partnerMirroringCert") + private String partnerMirroringCert; + + /* + * The partner sync mode of the SQL managed instance. + */ + @JsonProperty(value = "partnerSyncMode") + private FailoverGroupPartnerSyncMode partnerSyncMode; + + /* + * The role of the SQL managed instance in this failover group. + */ + @JsonProperty(value = "role", required = true) + private InstanceFailoverGroupRole role; + + /* + * The specifications of the failover group resource. + */ + @JsonIgnore 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. + */ + @JsonAnyGetter + 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; + } + + @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 (role() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property role in model FailoverGroupSpec")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FailoverGroupSpec.class); +} 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..ca1fd22b953a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroups.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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/HostType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/HostType.java new file mode 100644 index 000000000000..92e19b0899d1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/HostType.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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/InstanceFailoverGroupRole.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/InstanceFailoverGroupRole.java new file mode 100644 index 000000000000..3f5bcab06770 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/InstanceFailoverGroupRole.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; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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/K8SActiveDirectory.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectory.java new file mode 100644 index 000000000000..26ec9c707080 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectory.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.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The kubernetes active directory information. */ +@Fluent +public final class K8SActiveDirectory { + /* + * The connector property. + */ + @JsonProperty(value = "connector") + private K8SActiveDirectoryConnector connector; + + /* + * Account name for AAD + */ + @JsonProperty(value = "accountName") + private String accountName; + + /* + * Keytab secret used to authenticate with Active Directory. + */ + @JsonProperty(value = "keytabSecret") + private String keytabSecret; + + /* + * An array of encryption types + */ + @JsonProperty(value = "encryptionTypes") + 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(); + } + } +} 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..ab8956971801 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectoryConnector.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The K8SActiveDirectoryConnector model. */ +@Fluent +public final class K8SActiveDirectoryConnector { + /* + * Name of the connector + */ + @JsonProperty(value = "name") + private String name; + + /* + * Name space of the connector + */ + @JsonProperty(value = "namespace") + 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() { + } +} 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..05b0e5f93cfe --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SNetworkSettings.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.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The kubernetes network settings information. */ +@Fluent +public final class K8SNetworkSettings { + /* + * If 1, then SQL Server forces all connections to be encrypted. By default, this option is 0 + */ + @JsonProperty(value = "forceencryption") + private Integer forceencryption; + + /* + * Specifies which ciphers are allowed by SQL Server for TLS + */ + @JsonProperty(value = "tlsciphers") + private String tlsciphers; + + /* + * A comma-separated list of which TLS protocols are allowed by SQL Server + */ + @JsonProperty(value = "tlsprotocols") + 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() { + } +} 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..580759428f64 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSecurity.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.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 java.util.Map; + +/** The kubernetes security information. */ +@Fluent +public final class K8SSecurity { + /* + * Admin login secret key + */ + @JsonProperty(value = "adminLoginSecret") + private String adminLoginSecret; + + /* + * Service certificate secret used + */ + @JsonProperty(value = "serviceCertificateSecret") + private String serviceCertificateSecret; + + /* + * The kubernetes active directory information. + */ + @JsonProperty(value = "activeDirectory") + private K8SActiveDirectory activeDirectory; + + /* + * Transparent data encryption information. + */ + @JsonProperty(value = "transparentDataEncryption") + private K8StransparentDataEncryption transparentDataEncryption; + + /* + * The kubernetes security information. + */ + @JsonIgnore 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. + */ + @JsonAnyGetter + 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; + } + + @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 (activeDirectory() != null) { + activeDirectory().validate(); + } + if (transparentDataEncryption() != null) { + transparentDataEncryption().validate(); + } + } +} 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..f77a027e5b75 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSettings.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 java.util.Map; + +/** The kubernetes settings information. */ +@Fluent +public final class K8SSettings { + /* + * The kubernetes network settings information. + */ + @JsonProperty(value = "network") + private K8SNetworkSettings network; + + /* + * The kubernetes settings information. + */ + @JsonIgnore 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. + */ + @JsonAnyGetter + 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; + } + + @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 (network() != null) { + network().validate(); + } + } +} 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..efacadbeef41 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8StransparentDataEncryption.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Transparent data encryption information. */ +@Fluent +public final class K8StransparentDataEncryption { + /* + * Transparent data encryption mode. Can be Service Managed, Customer managed or disabled + */ + @JsonProperty(value = "mode") + private String mode; + + /* + * Protector secret for customer managed Transparent data encryption mode + */ + @JsonProperty(value = "protectorSecret") + 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() { + } +} 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..73838b5eb5af --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/KeytabInformation.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Keytab used for authenticate with Active Directory. */ +@Fluent +public final class KeytabInformation { + /* + * A base64-encoded keytab. + */ + @JsonProperty(value = "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() { + } +} 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..7609b45c0ba4 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 @@ -9,11 +9,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The PageOfDataControllerResource model. */ +/** A list of data controllers. */ @Fluent public final class PageOfDataControllerResource { /* - * The value property. + * Array of results. */ @JsonProperty(value = "value") private List value; @@ -29,7 +29,7 @@ public PageOfDataControllerResource() { } /** - * Get the value property: The value property. + * Get the value property: Array of results. * * @return the value value. */ @@ -38,7 +38,7 @@ 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. 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..ad1a5cb7c400 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstance.java @@ -0,0 +1,270 @@ +// Copyright (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..d97efe6f250d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceListResult.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; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.azurearcdata.fluent.models.PostgresInstanceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of PostgresInstance. */ +@Immutable +public final class PostgresInstanceListResult { + /* + * 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 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()); + } + } +} 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..7ea10926c65f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Postgres Instance properties. */ +@Fluent +public final class PostgresInstanceProperties { + /* + * The data controller id + */ + @JsonProperty(value = "dataControllerId") + private String dataControllerId; + + /* + * The instance admin + */ + @JsonProperty(value = "admin") + private String admin; + + /* + * Username and password for basic authentication. + */ + @JsonProperty(value = "basicLoginInformation") + private BasicLoginInformation basicLoginInformation; + + /* + * The raw kubernetes information + */ + @JsonProperty(value = "k8sRaw") + private Object k8SRaw; + + /* + * Last uploaded date from Kubernetes cluster. Defaults to current date time + */ + @JsonProperty(value = "lastUploadedDate") + private OffsetDateTime lastUploadedDate; + + /* + * The provisioning state of the Azure Arc-enabled PostgreSQL instance. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + 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(); + } + } +} 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..447cfb3301ff --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSku.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** 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. + */ + @JsonProperty(value = "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() { + super.validate(); + } +} 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..e98ec41214b1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSkuTier.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** 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. + */ + @JsonCreator + 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} */ + @JsonValue + @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..0c65194705de --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceUpdate.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An update to a Postgres Instance. */ +@Fluent +public final class PostgresInstanceUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * Postgres Instance properties. + */ + @JsonProperty(value = "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(); + } + } +} 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..62076b56c9dd --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstances.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.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/ProvisioningState.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ProvisioningState.java new file mode 100644 index 000000000000..2131b38f161a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ProvisioningState.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/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..1855dd4dc475 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/RecoveryMode.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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. + */ + @JsonCreator + 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/SqlManagedInstance.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstance.java index e2d2a9b66574..41abf6916682 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 @@ -69,7 +69,7 @@ public interface SqlManagedInstance { 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. */ 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..39b9695c72a5 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 @@ -29,6 +29,18 @@ public final class SqlManagedInstanceK8SSpec { @JsonProperty(value = "replicas") private Integer replicas; + /* + * The kubernetes security information. + */ + @JsonProperty(value = "security") + private K8SSecurity security; + + /* + * The kubernetes settings information. + */ + @JsonProperty(value = "settings") + private K8SSettings settings; + /* * The kubernetes spec information. */ @@ -82,6 +94,46 @@ 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. * @@ -120,5 +172,11 @@ public void validate() { if (scheduling() != null) { scheduling().validate(); } + if (security() != null) { + security().validate(); + } + if (settings() != null) { + settings().validate(); + } } } 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..d4087ab2a0b8 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 @@ -54,11 +54,17 @@ public final class SqlManagedInstanceProperties { 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. + */ + @JsonProperty(value = "activeDirectoryInformation") + private ActiveDirectoryInformation activeDirectoryInformation; + /* * The license type to apply for this managed instance. */ @@ -223,7 +229,7 @@ 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. */ @@ -231,6 +237,27 @@ 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. * @@ -307,5 +334,8 @@ public void validate() { if (basicLoginInformation() != null) { basicLoginInformation().validate(); } + if (activeDirectoryInformation() != null) { + activeDirectoryInformation().validate(); + } } } 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..22b6df38ce90 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 @@ -36,13 +36,13 @@ public final class SqlManagedInstanceSku { 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; @@ -137,7 +137,7 @@ public SqlManagedInstanceSku withSize(String size) { } /** - * Get the family property: The family property. + * Get the family property: The SKU family. * * @return the family value. */ @@ -146,7 +146,7 @@ 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,7 +157,7 @@ public SqlManagedInstanceSku withFamily(String family) { } /** - * Get the capacity property: The capacity property. + * Get the capacity property: The SKU capacity. * * @return the capacity value. */ @@ -166,7 +166,7 @@ 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. 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..17e7d613ba15 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 @@ -87,7 +87,7 @@ 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. @@ -98,7 +98,7 @@ 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. 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..90546fce7cd2 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResource.java @@ -0,0 +1,236 @@ +// Copyright (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..38e4a6b65566 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourceProperties.java @@ -0,0 +1,308 @@ +// Copyright (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.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of Arc Sql Server database resource. */ +@Fluent +public final class SqlServerDatabaseResourceProperties { + /* + * Collation of the database. + */ + @JsonProperty(value = "collationName") + private String collationName; + + /* + * Creation date of the database. + */ + @JsonProperty(value = "databaseCreationDate") + private OffsetDateTime databaseCreationDate; + + /* + * Compatibility level of the database + */ + @JsonProperty(value = "compatibilityLevel") + private Integer compatibilityLevel; + + /* + * Size of the database. + */ + @JsonProperty(value = "sizeMB") + private Float sizeMB; + + /* + * Space left of the database. + */ + @JsonProperty(value = "spaceAvailableMB") + private Float spaceAvailableMB; + + /* + * State of the database. + */ + @JsonProperty(value = "state") + private DatabaseState state; + + /* + * Whether the database is read only or not. + */ + @JsonProperty(value = "isReadOnly") + private Boolean isReadOnly; + + /* + * Status of the database. + */ + @JsonProperty(value = "recoveryMode") + private RecoveryMode recoveryMode; + + /* + * List of features that are enabled for the database + */ + @JsonProperty(value = "databaseOptions") + private SqlServerDatabaseResourcePropertiesDatabaseOptions databaseOptions; + + /* + * The backupInformation property. + */ + @JsonProperty(value = "backupInformation") + private SqlServerDatabaseResourcePropertiesBackupInformation backupInformation; + + /* + * The provisioning state of the Arc-enabled SQL Server database resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** 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 provisioningState property: The provisioning state of the Arc-enabled SQL Server database 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 (databaseOptions() != null) { + databaseOptions().validate(); + } + if (backupInformation() != null) { + backupInformation().validate(); + } + } +} 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..3c7fe14b15a8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesBackupInformation.java @@ -0,0 +1,77 @@ +// Copyright (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.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The SqlServerDatabaseResourcePropertiesBackupInformation model. */ +@Fluent +public final class SqlServerDatabaseResourcePropertiesBackupInformation { + /* + * Date time of last full backup. + */ + @JsonProperty(value = "lastFullBackup") + private OffsetDateTime lastFullBackup; + + /* + * Date time of last log backup. + */ + @JsonProperty(value = "lastLogBackup") + 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() { + } +} 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..70da07b3ea19 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesDatabaseOptions.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** List of features that are enabled for the database. */ +@Fluent +public final class SqlServerDatabaseResourcePropertiesDatabaseOptions { + /* + * The isAutoCloseOn property. + */ + @JsonProperty(value = "isAutoCloseOn") + private Boolean isAutoCloseOn; + + /* + * The isAutoShrinkOn property. + */ + @JsonProperty(value = "isAutoShrinkOn") + private Boolean isAutoShrinkOn; + + /* + * The isAutoCreateStatsOn property. + */ + @JsonProperty(value = "isAutoCreateStatsOn") + private Boolean isAutoCreateStatsOn; + + /* + * The isAutoUpdateStatsOn property. + */ + @JsonProperty(value = "isAutoUpdateStatsOn") + private Boolean isAutoUpdateStatsOn; + + /* + * The isRemoteDataArchiveEnabled property. + */ + @JsonProperty(value = "isRemoteDataArchiveEnabled") + private Boolean isRemoteDataArchiveEnabled; + + /* + * The isMemoryOptimizationEnabled property. + */ + @JsonProperty(value = "isMemoryOptimizationEnabled") + private Boolean isMemoryOptimizationEnabled; + + /* + * The isEncrypted property. + */ + @JsonProperty(value = "isEncrypted") + private Boolean isEncrypted; + + /* + * The isTrustworthyOn property. + */ + @JsonProperty(value = "isTrustworthyOn") + 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() { + } +} 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..94f3454e9c25 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseUpdate.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An update to database resource. */ +@Fluent +public final class SqlServerDatabaseUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The data controller's properties + */ + @JsonProperty(value = "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(); + } + } +} 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..b04facdd1741 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabases.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 deleteWithResponse( + 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. + */ + void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName); + + /** + * 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. + * @return the {@link Response}. + */ + Response 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/SqlServerInstance.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstance.java index 01c74102532e..18b4c0fcaa87 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 @@ -55,7 +55,7 @@ public interface SqlServerInstance { 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. */ 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..99b30776c5ca 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 @@ -42,6 +42,12 @@ public final class SqlServerInstanceProperties { @JsonProperty(value = "vCore") private String vCore; + /* + * The number of total cores of the Operating System Environment (OSE) hosting the SQL Server instance. + */ + @JsonProperty(value = "cores") + private String cores; + /* * The cloud connectivity status. */ @@ -109,11 +115,17 @@ public final class SqlServerInstanceProperties { 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; + /* + * Type of host for Azure Arc SQL Server + */ + @JsonProperty(value = "hostType") + private HostType hostType; + /** Creates an instance of SqlServerInstanceProperties class. */ public SqlServerInstanceProperties() { } @@ -207,6 +219,28 @@ public SqlServerInstanceProperties withVCore(String vCore) { return this; } + /** + * 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 withCores(String cores) { + this.cores = cores; + return this; + } + /** * Get the status property: The cloud connectivity status. * @@ -429,7 +463,7 @@ public SqlServerInstanceProperties withAzureDefenderStatus(DefenderStatus azureD } /** - * Get the provisioningState property: The provisioningState property. + * Get the provisioningState property: The provisioning state of the Arc-enabled SQL Server resource. * * @return the provisioningState value. */ @@ -437,6 +471,26 @@ public String provisioningState() { return this.provisioningState; } + /** + * 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 withHostType(HostType hostType) { + this.hostType = hostType; + return this; + } + /** * Validates the instance. * 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..da60c6e56920 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 @@ -87,7 +87,7 @@ 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. @@ -98,7 +98,7 @@ 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. 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..c6d44dd109cd 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 @@ -10,15 +10,27 @@ /** 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. */ 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. * 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..6cc818c4ef93 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsCreateSamples.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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/2023-01-15-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..3cc9792c6f00 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** Samples for ActiveDirectoryConnectors Delete. */ +public final class ActiveDirectoryConnectorsDeleteSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-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..bf70088b5f1f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** Samples for ActiveDirectoryConnectors Get. */ +public final class ActiveDirectoryConnectorsGetSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-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..7822e40fcdb2 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** Samples for ActiveDirectoryConnectors List. */ +public final class ActiveDirectoryConnectorsListSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-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..7ed722015241 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 @@ -7,7 +7,7 @@ /** 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/2023-01-15-preview/examples/DeleteDataController.json */ /** * Sample code: Delete a dataController. 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..a491fc6bf203 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 @@ -7,7 +7,7 @@ /** 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/2023-01-15-preview/examples/GetDataController.json */ /** * Sample code: Get a data controller. 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..083e193ed331 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 @@ -7,7 +7,7 @@ /** 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/2023-01-15-preview/examples/ListByResourceGroupDataController.json */ /** * Sample code: Gets all dataControllers in a resource group. 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..b1126fee935e 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 @@ -7,7 +7,7 @@ /** 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/2023-01-15-preview/examples/ListSubscriptionDataController.json */ /** * Sample code: Gets all dataControllers in a subscription. 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..fac940df2a22 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 @@ -11,7 +11,7 @@ /** 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/2023-01-15-preview/examples/UpdateDataController.json */ /** * Sample code: Updates a dataController tags. 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..20b89f9745cf 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 @@ -21,7 +21,7 @@ /** 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/2023-01-15-preview/examples/CreateOrUpdateDataController.json */ /** * Sample code: Create or update a Data Controller. @@ -49,6 +49,10 @@ public static void createOrUpdateADataController( .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")) 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..c35a7d9638e5 --- /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/2023-01-15-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(); + } + + @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..8805ec7eec27 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** Samples for FailoverGroups Delete. */ +public final class FailoverGroupsDeleteSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-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..4e99e42192f1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsGetSamples.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 FailoverGroups Get. */ +public final class FailoverGroupsGetSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-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..c955bef4a917 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** Samples for FailoverGroups List. */ +public final class FailoverGroupsListSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-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..4ed122e50340 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 @@ -7,7 +7,7 @@ /** 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/2023-01-15-preview/examples/ListOperation.json */ /** * Sample code: Lists all of the available Azure Data Services on Azure Arc API operations. 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..f340c09139d8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesCreateSamples.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.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/2023-01-15-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..8a10e84967df --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** Samples for PostgresInstances Delete. */ +public final class PostgresInstancesDeleteSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-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..13389185f3ae --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** Samples for PostgresInstances GetByResourceGroup. */ +public final class PostgresInstancesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-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..205a6c8411d8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** Samples for PostgresInstances ListByResourceGroup. */ +public final class PostgresInstancesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-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..b6908eb9fbf2 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** Samples for PostgresInstances List. */ +public final class PostgresInstancesListSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-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..21cc9573982f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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/2023-01-15-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(); + } + + @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..099ed21752cc 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,25 +4,34 @@ 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. */ 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/2023-01-15-preview/examples/CreateOrUpdateSqlManagedInstance.json */ /** * Sample code: Create or update a SQL Managed Instance. @@ -71,10 +80,41 @@ public static void createOrUpdateASQLManagedInstance( .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") 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..c5c22b1924f9 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 @@ -7,7 +7,7 @@ /** 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/2023-01-15-preview/examples/DeleteSqlManagedInstance.json */ /** * Sample code: Delete a SQL Instance. 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..be682b8cafe3 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 @@ -7,7 +7,7 @@ /** 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/2023-01-15-preview/examples/GetSqlManagedInstance.json */ /** * Sample code: Updates a SQL Instance tags. 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..d9df0aeeeed8 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 @@ -7,7 +7,7 @@ /** 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/2023-01-15-preview/examples/ListByResourceGroupSqlManagedInstance.json */ /** * Sample code: Gets all SQL Instance in a resource group. 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..55024e5c7299 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 @@ -7,7 +7,7 @@ /** 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/2023-01-15-preview/examples/ListSubscriptionSqlManagedInstance.json */ /** * Sample code: Gets all SQL Instance in a subscription. 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..ce49fef06077 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 @@ -11,7 +11,7 @@ /** 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/2023-01-15-preview/examples/UpdateSqlManagedInstance.json */ /** * Sample code: Updates a sql Instance tags. 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..bb03c6a536be --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesCreateSamples.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.DatabaseState; +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/2023-01-15-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")))) + .withTags(mapOf("mytag", "myval")) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/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..85844ec73ab7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** Samples for SqlServerDatabases Delete. */ +public final class SqlServerDatabasesDeleteSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-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() + .deleteWithResponse("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..c3e797ba3a84 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** Samples for SqlServerDatabases Get. */ +public final class SqlServerDatabasesGetSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-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..5f134078f01b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** Samples for SqlServerDatabases List. */ +public final class SqlServerDatabasesListSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-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..bc30b390a2fb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesUpdateSamples.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.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/2023-01-15-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(); + } + + @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..479425718b2f 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 @@ -8,6 +8,7 @@ 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.HostType; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties; import com.azure.resourcemanager.azurearcdata.models.SqlVersion; import java.time.OffsetDateTime; @@ -17,7 +18,7 @@ /** 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/2023-01-15-preview/examples/CreateOrUpdateSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. @@ -34,21 +35,23 @@ public static void updatesASQLServerInstanceTags( .withTags(mapOf("mytag", "myval")) .withProperties( new SqlServerInstanceProperties() - .withVersion(SqlVersion.SQL_SERVER_2017) + .withVersion(SqlVersion.SQL_SERVER_2012) .withEdition(EditionType.DEVELOPER) - .withContainerResourceId("Arc Machine Name") + .withContainerResourceId("Resource id of hosting Arc Machine") .withVCore("4") - .withStatus(ConnectionStatus.CONNECTED) + .withCores("4") + .withStatus(ConnectionStatus.REGISTERED) .withPatchLevel("patchlevel") .withCollation("collation") - .withCurrentVersion("2008 R2") + .withCurrentVersion("2012") .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)) + .withAzureDefenderStatus(DefenderStatus.PROTECTED) + .withHostType(HostType.PHYSICAL_SERVER)) .create(); } 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..cacf6511b001 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 @@ -7,7 +7,7 @@ /** 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/2023-01-15-preview/examples/DeleteSqlServerInstance.json */ /** * Sample code: Delete a SQL Server Instance. 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..d51631128ac3 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 @@ -7,7 +7,7 @@ /** 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/2023-01-15-preview/examples/GetSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. 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..7d501064c3f2 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 @@ -7,7 +7,7 @@ /** 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/2023-01-15-preview/examples/ListByResourceGroupSqlServerInstance.json */ /** * Sample code: Gets all SQL Server Instance in a resource group. 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..91311e10267a 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 @@ -7,7 +7,7 @@ /** 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/2023-01-15-preview/examples/ListSubscriptionSqlServerInstance.json */ /** * Sample code: Gets all SQL Server Instance in a subscription. 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..a8c119ab7cfc 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 @@ -11,7 +11,7 @@ /** 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/2023-01-15-preview/examples/UpdateSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. 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()); - } -}