From 86d00d11e28c790d195352384ba93ad9711842bd Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 21 Mar 2023 12:07:28 +0000 Subject: [PATCH] CodeGen from PR 23193 in Azure/azure-rest-api-specs Merge 3f9d64273b54275982751ab797fd00184feb1769 into 969fd0c2634fbcc1975d7abe3749330a5145a97c --- .../CHANGELOG.md | 4 +- .../README.md | 4 +- .../SAMPLE.md | 1645 +++++++++++++++-- .../pom.xml | 10 +- .../azurearcdata/AzureArcDataManager.java | 135 +- .../ActiveDirectoryConnectorsClient.java | 215 +++ .../fluent/AzureArcDataManagementClient.java | 56 + .../fluent/DataControllersClient.java | 72 +- .../fluent/FailoverGroupsClient.java | 213 +++ .../fluent/PostgresInstancesClient.java | 242 +++ .../SqlAvailabilityGroupDatabasesClient.java | 191 ++ .../SqlAvailabilityGroupReplicasClient.java | 185 ++ .../fluent/SqlAvailabilityGroupsClient.java | 252 +++ .../fluent/SqlManagedInstancesClient.java | 20 +- .../SqlServerAvailabilityGroupsClient.java | 184 ++ .../fluent/SqlServerDatabasesClient.java | 183 ++ .../fluent/SqlServerInstancesClient.java | 20 +- ...ActiveDirectoryConnectorResourceInner.java | 79 + .../models/DataControllerResourceInner.java | 4 +- .../models/FailoverGroupResourceInner.java | 79 + .../fluent/models/PostgresInstanceInner.java | 154 ++ ...vailabilityGroupDatabaseResourceInner.java | 95 + .../models/SqlAvailabilityGroupInner.java | 86 + ...AvailabilityGroupReplicaResourceInner.java | 95 + .../models/SqlManagedInstanceInner.java | 4 +- ...lServerAvailabilityGroupResourceInner.java | 95 + .../SqlServerDatabaseResourceInner.java | 94 + .../fluent/models/SqlServerInstanceInner.java | 4 +- .../ActiveDirectoryConnectorResourceImpl.java | 122 ++ .../ActiveDirectoryConnectorsClientImpl.java | 1207 ++++++++++++ .../ActiveDirectoryConnectorsImpl.java | 214 +++ .../AzureArcDataManagementClientImpl.java | 114 +- .../DataControllerResourceImpl.java | 17 +- .../DataControllersClientImpl.java | 257 ++- .../FailoverGroupResourceImpl.java | 114 ++ .../FailoverGroupsClientImpl.java | 1160 ++++++++++++ .../implementation/FailoverGroupsImpl.java | 207 +++ .../implementation/PostgresInstanceImpl.java | 217 +++ .../PostgresInstancesClientImpl.java | 1445 +++++++++++++++ .../implementation/PostgresInstancesImpl.java | 179 ++ ...AvailabilityGroupDatabaseResourceImpl.java | 230 +++ ...lAvailabilityGroupDatabasesClientImpl.java | 1222 ++++++++++++ .../SqlAvailabilityGroupDatabasesImpl.java | 226 +++ .../SqlAvailabilityGroupImpl.java | 193 ++ ...lAvailabilityGroupReplicaResourceImpl.java | 221 +++ ...qlAvailabilityGroupReplicasClientImpl.java | 1175 ++++++++++++ .../SqlAvailabilityGroupReplicasImpl.java | 221 +++ .../SqlAvailabilityGroupsClientImpl.java | 1486 +++++++++++++++ .../SqlAvailabilityGroupsImpl.java | 186 ++ .../SqlManagedInstancesClientImpl.java | 65 +- ...qlServerAvailabilityGroupResourceImpl.java | 221 +++ ...SqlServerAvailabilityGroupsClientImpl.java | 1173 ++++++++++++ .../SqlServerAvailabilityGroupsImpl.java | 221 +++ .../SqlServerDatabaseResourceImpl.java | 209 +++ .../SqlServerDatabasesClientImpl.java | 1131 ++++++++++++ .../SqlServerDatabasesImpl.java | 201 ++ .../SqlServerInstancesClientImpl.java | 65 +- .../models/AccountProvisioningMode.java | 47 + .../ActiveDirectoryConnectorDnsDetails.java | 143 ++ ...ActiveDirectoryConnectorDomainDetails.java | 172 ++ .../ActiveDirectoryConnectorListResult.java | 59 + .../ActiveDirectoryConnectorProperties.java | 137 ++ .../ActiveDirectoryConnectorResource.java | 123 ++ .../models/ActiveDirectoryConnectorSpec.java | 95 + .../ActiveDirectoryConnectorStatus.java | 143 ++ .../models/ActiveDirectoryConnectors.java | 145 ++ .../ActiveDirectoryDomainController.java | 59 + .../ActiveDirectoryDomainControllers.java | 85 + .../models/ActiveDirectoryInformation.java | 55 + ...lAvailabilityGroupDatabasesListResult.java | 59 + ...SqlAvailabilityGroupReplicaListResult.java | 59 + .../ArcSqlManagedInstanceLicenseType.java | 57 +- ...cSqlServerAvailabilityGroupListResult.java | 59 + .../ArcSqlServerDatabaseListResult.java | 59 + .../models/ArcSqlServerLicenseType.java | 17 +- .../models/AvailabilityGroupConfigure.java | 346 ++++ .../models/AvailabilityGroupState.java | 207 +++ .../azurearcdata/models/CommonSku.java | 171 ++ .../azurearcdata/models/ConnectionStatus.java | 3 + .../models/DataControllerProperties.java | 79 +- .../models/DataControllerResource.java | 14 +- .../models/DataControllerUpdate.java | 29 + .../azurearcdata/models/DataControllers.java | 16 +- .../azurearcdata/models/DatabaseState.java | 68 + .../azurearcdata/models/EditionType.java | 3 + .../models/FailoverGroupListResult.java | 59 + .../models/FailoverGroupPartnerSyncMode.java | 47 + .../models/FailoverGroupProperties.java | 172 ++ .../models/FailoverGroupResource.java | 123 ++ .../models/FailoverGroupSpec.java | 258 +++ .../azurearcdata/models/FailoverGroups.java | 142 ++ .../azurearcdata/models/HostType.java | 80 + .../models/InstanceFailoverGroupRole.java | 54 + .../models/KeytabInformation.java | 50 + .../models/PageOfDataControllerResource.java | 8 +- .../azurearcdata/models/PostgresInstance.java | 270 +++ .../models/PostgresInstanceListResult.java | 59 + .../models/PostgresInstanceProperties.java | 173 ++ .../models/PostgresInstanceSku.java | 89 + .../models/PostgresInstanceSkuTier.java | 48 + .../models/PostgresInstanceUpdate.java | 82 + .../models/PostgresInstances.java | 160 ++ .../models/ProvisioningState.java | 53 + .../azurearcdata/models/RecoveryMode.java | 50 + .../models/SqlAvailabilityGroup.java | 224 +++ ...roupDatabaseReplicaResourceProperties.java | 276 +++ .../SqlAvailabilityGroupDatabaseResource.java | 237 +++ .../SqlAvailabilityGroupDatabaseUpdate.java | 83 + .../models/SqlAvailabilityGroupDatabases.java | 153 ++ .../SqlAvailabilityGroupListResult.java | 59 + ...ultiDatabaseReplicaResourceProperties.java | 97 + .../SqlAvailabilityGroupProperties.java | 355 ++++ .../SqlAvailabilityGroupReplicaResource.java | 237 +++ ...abilityGroupReplicaResourceProperties.java | 150 ++ .../SqlAvailabilityGroupReplicaUpdate.java | 82 + .../models/SqlAvailabilityGroupReplicas.java | 147 ++ .../models/SqlAvailabilityGroupUpdate.java | 53 + .../models/SqlAvailabilityGroups.java | 160 ++ .../models/SqlManagedInstance.java | 2 +- .../models/SqlManagedInstanceProperties.java | 34 +- .../models/SqlManagedInstanceSku.java | 12 +- .../models/SqlManagedInstances.java | 4 +- .../SqlServerAvailabilityGroupResource.java | 237 +++ ...erAvailabilityGroupResourceProperties.java | 160 ++ .../SqlServerAvailabilityGroupUpdate.java | 82 + .../models/SqlServerAvailabilityGroups.java | 147 ++ .../models/SqlServerDatabaseResource.java | 236 +++ .../SqlServerDatabaseResourceProperties.java | 308 +++ ...seResourcePropertiesBackupInformation.java | 77 + ...baseResourcePropertiesDatabaseOptions.java | 234 +++ .../models/SqlServerDatabaseUpdate.java | 82 + .../models/SqlServerDatabases.java | 146 ++ .../models/SqlServerInstance.java | 2 +- .../models/SqlServerInstanceProperties.java | 58 +- .../models/SqlServerInstances.java | 4 +- .../azurearcdata/models/SqlVersion.java | 20 +- ...ctiveDirectoryConnectorsCreateSamples.java | 58 + ...ctiveDirectoryConnectorsDeleteSamples.java | 23 + .../ActiveDirectoryConnectorsGetSamples.java | 23 + .../ActiveDirectoryConnectorsListSamples.java | 21 + .../DataControllersDeleteSamples.java | 2 +- ...aControllersGetByResourceGroupSamples.java | 2 +- ...ControllersListByResourceGroupSamples.java | 2 +- .../generated/DataControllersListSamples.java | 2 +- ...ControllersPatchDataControllerSamples.java | 2 +- ...taControllersPutDataControllerSamples.java | 6 +- .../FailoverGroupsCreateSamples.java | 53 + .../FailoverGroupsDeleteSamples.java | 23 + .../generated/FailoverGroupsGetSamples.java | 24 + .../generated/FailoverGroupsListSamples.java | 21 + .../generated/OperationsListSamples.java | 2 +- .../PostgresInstancesCreateSamples.java | 59 + .../PostgresInstancesDeleteSamples.java | 20 + ...resInstancesGetByResourceGroupSamples.java | 22 + ...esInstancesListByResourceGroupSamples.java | 21 + .../PostgresInstancesListSamples.java | 21 + .../PostgresInstancesUpdateSamples.java | 41 + ...ailabilityGroupDatabasesCreateSamples.java | 68 + ...ailabilityGroupDatabasesDeleteSamples.java | 23 + ...lAvailabilityGroupDatabasesGetSamples.java | 23 + ...AvailabilityGroupDatabasesListSamples.java | 21 + ...ailabilityGroupDatabasesUpdateSamples.java | 71 + ...vailabilityGroupReplicasCreateSamples.java | 68 + ...vailabilityGroupReplicasDeleteSamples.java | 23 + ...qlAvailabilityGroupReplicasGetSamples.java | 23 + ...lAvailabilityGroupReplicasListSamples.java | 21 + ...vailabilityGroupReplicasUpdateSamples.java | 41 + .../SqlAvailabilityGroupsCreateSamples.java | 57 + .../SqlAvailabilityGroupsDeleteSamples.java | 20 + ...bilityGroupsGetByResourceGroupSamples.java | 23 + ...ilityGroupsListByResourceGroupSamples.java | 21 + .../SqlAvailabilityGroupsListSamples.java | 21 + .../SqlAvailabilityGroupsUpdateSamples.java | 41 + .../SqlManagedInstancesCreateSamples.java | 7 +- .../SqlManagedInstancesDeleteSamples.java | 2 +- ...gedInstancesGetByResourceGroupSamples.java | 2 +- ...edInstancesListByResourceGroupSamples.java | 2 +- .../SqlManagedInstancesListSamples.java | 2 +- .../SqlManagedInstancesUpdateSamples.java | 2 +- ...ServerAvailabilityGroupsCreateSamples.java | 68 + ...ServerAvailabilityGroupsDeleteSamples.java | 24 + ...SqlServerAvailabilityGroupsGetSamples.java | 23 + ...qlServerAvailabilityGroupsListSamples.java | 21 + ...ServerAvailabilityGroupsUpdateSamples.java | 40 + .../SqlServerDatabasesCreateSamples.java | 70 + .../SqlServerDatabasesDeleteSamples.java | 22 + .../SqlServerDatabasesGetSamples.java | 23 + .../SqlServerDatabasesListSamples.java | 21 + .../SqlServerDatabasesUpdateSamples.java | 40 + .../SqlServerInstancesCreateSamples.java | 15 +- .../SqlServerInstancesDeleteSamples.java | 2 +- ...verInstancesGetByResourceGroupSamples.java | 2 +- ...erInstancesListByResourceGroupSamples.java | 2 +- .../SqlServerInstancesListSamples.java | 2 +- .../SqlServerInstancesUpdateSamples.java | 2 +- .../generated/DataControllerUpdateTests.java | 44 - .../DataControllersDeleteMockTests.java | 61 - .../generated/ExtendedLocationTests.java | 31 - .../K8SResourceRequirementsTests.java | 56 - .../generated/K8SSchedulingOptionsTests.java | 60 - .../generated/K8SSchedulingTests.java | 56 - .../generated/OperationDisplayTests.java | 39 - .../generated/OperationInnerTests.java | 48 - .../generated/OperationListResultTests.java | 25 - .../generated/OperationsListMockTests.java | 72 - .../PageOfDataControllerResourceTests.java | 125 -- .../SqlManagedInstanceK8SRawTests.java | 50 - .../SqlManagedInstanceK8SSpecTests.java | 50 - .../SqlManagedInstanceListResultTests.java | 25 - .../generated/SqlManagedInstanceSkuTests.java | 43 - .../SqlManagedInstanceUpdateTests.java | 52 - .../SqlManagedInstancesDeleteMockTests.java | 61 - .../SqlServerInstanceInnerTests.java | 105 -- .../SqlServerInstanceListResultTests.java | 30 - .../SqlServerInstancePropertiesTests.java | 79 - .../SqlServerInstanceUpdateTests.java | 41 - .../SqlServerInstancesCreateMockTests.java | 128 -- .../SqlServerInstancesDeleteMockTests.java | 61 - ...tByResourceGroupWithResponseMockTests.java | 94 - ...InstancesListByResourceGroupMockTests.java | 95 - .../SqlServerInstancesListMockTests.java | 93 - .../generated/UploadWatermarkTests.java | 37 - 222 files changed, 27740 insertions(+), 2091 deletions(-) create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/ActiveDirectoryConnectorsClient.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/FailoverGroupsClient.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/PostgresInstancesClient.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlAvailabilityGroupDatabasesClient.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlAvailabilityGroupReplicasClient.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlAvailabilityGroupsClient.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerAvailabilityGroupsClient.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerDatabasesClient.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/ActiveDirectoryConnectorResourceInner.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/FailoverGroupResourceInner.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/PostgresInstanceInner.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlAvailabilityGroupDatabaseResourceInner.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlAvailabilityGroupInner.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlAvailabilityGroupReplicaResourceInner.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerAvailabilityGroupResourceInner.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerDatabaseResourceInner.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorResourceImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsClientImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupResourceImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsClientImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstanceImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesClientImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupDatabaseResourceImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupDatabasesClientImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupDatabasesImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupReplicaResourceImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupReplicasClientImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupReplicasImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupsClientImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupsImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupResourceImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsClientImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabaseResourceImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesClientImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesImpl.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AccountProvisioningMode.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDnsDetails.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDomainDetails.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorListResult.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorProperties.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorResource.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorSpec.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorStatus.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectors.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainController.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainControllers.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryInformation.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlAvailabilityGroupDatabasesListResult.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlAvailabilityGroupReplicaListResult.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityGroupListResult.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerDatabaseListResult.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupConfigure.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupState.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/CommonSku.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseState.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupListResult.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupPartnerSyncMode.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupProperties.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupResource.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupSpec.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroups.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/HostType.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/InstanceFailoverGroupRole.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/KeytabInformation.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstance.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceListResult.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceProperties.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSku.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSkuTier.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceUpdate.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstances.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ProvisioningState.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/RecoveryMode.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroup.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseReplicaResourceProperties.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseResource.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseUpdate.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabases.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupListResult.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupProperties.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaResource.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaResourceProperties.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaUpdate.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicas.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupUpdate.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroups.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResource.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourceProperties.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupUpdate.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroups.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResource.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourceProperties.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesBackupInformation.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesDatabaseOptions.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseUpdate.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabases.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsCreateSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsDeleteSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsGetSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsListSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsCreateSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsDeleteSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsGetSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsListSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesCreateSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesDeleteSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesGetByResourceGroupSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesListByResourceGroupSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesListSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesUpdateSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesCreateSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesDeleteSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesGetSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesListSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesUpdateSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasCreateSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasDeleteSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasGetSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasListSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasUpdateSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsCreateSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsDeleteSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsGetByResourceGroupSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsListByResourceGroupSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsListSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsUpdateSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDeleteSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsGetSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsListSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsUpdateSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesCreateSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesDeleteSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesGetSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesListSamples.java create mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesUpdateSamples.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DataControllerUpdateTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersDeleteMockTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ExtendedLocationTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SResourceRequirementsTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSchedulingOptionsTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSchedulingTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationDisplayTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationInnerTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationListResultTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationsListMockTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/PageOfDataControllerResourceTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceK8SRawTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceK8SSpecTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceListResultTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceSkuTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceUpdateTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesDeleteMockTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceInnerTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceListResultTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancePropertiesTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceUpdateTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesCreateMockTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesDeleteMockTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetByResourceGroupWithResponseMockTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListByResourceGroupMockTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListMockTests.java delete mode 100644 sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/UploadWatermarkTests.java diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/CHANGELOG.md b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/CHANGELOG.md index 77eda3362cc6..a21ce0a46981 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-03-21) + +- 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-03. 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..b63a8e3d146b 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-03. 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..4cc53aea8f97 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,51 @@ - [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) + +## SqlAvailabilityGroupDatabases + +- [Create](#sqlavailabilitygroupdatabases_create) +- [Delete](#sqlavailabilitygroupdatabases_delete) +- [Get](#sqlavailabilitygroupdatabases_get) +- [List](#sqlavailabilitygroupdatabases_list) +- [Update](#sqlavailabilitygroupdatabases_update) + +## SqlAvailabilityGroupReplicas + +- [Create](#sqlavailabilitygroupreplicas_create) +- [Delete](#sqlavailabilitygroupreplicas_delete) +- [Get](#sqlavailabilitygroupreplicas_get) +- [List](#sqlavailabilitygroupreplicas_list) +- [Update](#sqlavailabilitygroupreplicas_update) + +## SqlAvailabilityGroups + +- [Create](#sqlavailabilitygroups_create) +- [Delete](#sqlavailabilitygroups_delete) +- [GetByResourceGroup](#sqlavailabilitygroups_getbyresourcegroup) +- [List](#sqlavailabilitygroups_list) +- [ListByResourceGroup](#sqlavailabilitygroups_listbyresourcegroup) +- [Update](#sqlavailabilitygroups_update) + ## SqlManagedInstances - [Create](#sqlmanagedinstances_create) @@ -23,6 +71,22 @@ - [ListByResourceGroup](#sqlmanagedinstances_listbyresourcegroup) - [Update](#sqlmanagedinstances_update) +## SqlServerAvailabilityGroups + +- [Create](#sqlserveravailabilitygroups_create) +- [Delete](#sqlserveravailabilitygroups_delete) +- [Get](#sqlserveravailabilitygroups_get) +- [List](#sqlserveravailabilitygroups_list) +- [Update](#sqlserveravailabilitygroups_update) + +## SqlServerDatabases + +- [Create](#sqlserverdatabases_create) +- [Delete](#sqlserverdatabases_delete) +- [Get](#sqlserverdatabases_get) +- [List](#sqlserverdatabases_list) +- [Update](#sqlserverdatabases_update) + ## SqlServerInstances - [Create](#sqlserverinstances_create) @@ -31,13 +95,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-03-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-03-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-03-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-03-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-03-15-preview/examples/DeleteDataController.json */ /** * Sample code: Delete a dataController. @@ -56,7 +241,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-03-15-preview/examples/GetDataController.json */ /** * Sample code: Get a data controller. @@ -77,7 +262,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-03-15-preview/examples/ListSubscriptionDataController.json */ /** * Sample code: Gets all dataControllers in a subscription. @@ -97,7 +282,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-03-15-preview/examples/ListByResourceGroupDataController.json */ /** * Sample code: Gets all dataControllers in a resource group. @@ -121,7 +306,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-03-15-preview/examples/UpdateDataController.json */ /** * Sample code: Updates a dataController tags. @@ -170,7 +355,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-03-15-preview/examples/CreateOrUpdateDataController.json */ /** * Sample code: Create or update a Data Controller. @@ -198,6 +383,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 +423,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-03-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-03-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-03-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-03-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-03-15-preview/examples/ListOperation.json */ /** * Sample code: Lists all of the available Azure Data Services on Azure Arc API operations. @@ -254,209 +560,941 @@ public final class OperationsListSamples { } ``` -### SqlManagedInstances_Create +### PostgresInstances_Create ```java -import com.azure.resourcemanager.azurearcdata.models.ArcSqlManagedInstanceLicenseType; +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.K8SResourceRequirements; -import com.azure.resourcemanager.azurearcdata.models.K8SScheduling; -import com.azure.resourcemanager.azurearcdata.models.K8SSchedulingOptions; -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.HashMap; -import java.util.Map; +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 SqlManagedInstances Create. */ -public final class SqlManagedInstancesCreateSamples { +/** Samples for PostgresInstances Create. */ +public final class PostgresInstancesCreateSamples { /* - * 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-03-15-preview/examples/CreateOrUpdatePostgresInstance.json */ /** - * Sample code: Create or update a SQL Managed Instance. + * Sample code: Create or update a Postgres Instance. * * @param manager Entry point to AzureArcDataManager. */ - public static void createOrUpdateASQLManagedInstance( - com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + public static void createOrUpdateAPostgresInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) throws IOException { manager - .sqlManagedInstances() - .define("testsqlManagedInstance") - .withRegion("northeurope") + .postgresInstances() + .define("testpostgresInstance") + .withRegion("eastus") .withExistingResourceGroup("testrg") .withProperties( - new SqlManagedInstanceProperties() - .withAdmin("Admin user") - .withStartTime("Instance start time") - .withEndTime("Instance end time") - .withK8SRaw( - new SqlManagedInstanceK8SRaw() - .withSpec( - new SqlManagedInstanceK8SSpec() - .withScheduling( - new K8SScheduling() - .withDefaultProperty( - new K8SSchedulingOptions() - .withResources( - new K8SResourceRequirements() - .withRequests( - mapOf( - "additionalProperty", - "additionalValue", - "cpu", - "1", - "memory", - "8Gi")) - .withLimits( - mapOf( - "additionalProperty", - "additionalValue", - "cpu", - "1", - "memory", - "8Gi")) - .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf())) - .withReplicas(1) - .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf("additionalProperty", 1234))) + new PostgresInstanceProperties() + .withDataControllerId("dataControllerId") + .withAdmin("admin") .withBasicLoginInformation( new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) - .withLicenseType(ArcSqlManagedInstanceLicenseType.LICENSE_INCLUDED) - .withClusterId( - "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s") - .withExtensionId( - "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension")) - .withTags(mapOf("mytag", "myval")) + .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 SqlManagedInstanceSku().withTier(SqlManagedInstanceSkuTier.GENERAL_PURPOSE).withDev(true)) + .withSku( + new PostgresInstanceSku() + .withName("default") + .withDev(true) + .withTier(PostgresInstanceSkuTier.HYPERSCALE)) .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; - } } ``` -### SqlManagedInstances_Delete +### PostgresInstances_Delete ```java -/** Samples for SqlManagedInstances Delete. */ -public final class SqlManagedInstancesDeleteSamples { +/** Samples for PostgresInstances Delete. */ +public final class PostgresInstancesDeleteSamples { /* - * 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-03-15-preview/examples/DeletePostgresInstance.json */ /** - * Sample code: Delete a SQL Instance. + * Sample code: Deletes a PostgresInstances. * * @param manager Entry point to AzureArcDataManager. */ - public static void deleteASQLInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager.sqlManagedInstances().delete("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE); + public static void deletesAPostgresInstances(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances().delete("testrg", "testpostgresInstance", com.azure.core.util.Context.NONE); } } ``` -### SqlManagedInstances_GetByResourceGroup +### PostgresInstances_GetByResourceGroup ```java -/** Samples for SqlManagedInstances GetByResourceGroup. */ -public final class SqlManagedInstancesGetByResourceGroupSamples { +/** Samples for PostgresInstances GetByResourceGroup. */ +public final class PostgresInstancesGetByResourceGroupSamples { /* - * 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-03-15-preview/examples/GetPostgresInstance.json */ /** - * Sample code: Updates a SQL Instance tags. + * Sample code: Gets a postgres Instances. * * @param manager Entry point to AzureArcDataManager. */ - public static void updatesASQLInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + public static void getsAPostgresInstances(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { manager - .sqlManagedInstances() - .getByResourceGroupWithResponse("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE); + .postgresInstances() + .getByResourceGroupWithResponse("testrg", "testpostgresInstances", com.azure.core.util.Context.NONE); } } ``` -### SqlManagedInstances_List +### PostgresInstances_List ```java -/** Samples for SqlManagedInstances List. */ -public final class SqlManagedInstancesListSamples { +/** Samples for PostgresInstances List. */ +public final class PostgresInstancesListSamples { /* - * 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-03-15-preview/examples/ListSubscriptionPostgresInstance.json */ /** - * Sample code: Gets all SQL Instance in a subscription. + * Sample code: Gets all Postgres Instance in a subscription. * * @param manager Entry point to AzureArcDataManager. */ - public static void getsAllSQLInstanceInASubscription( + public static void getsAllPostgresInstanceInASubscription( com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager.sqlManagedInstances().list(com.azure.core.util.Context.NONE); + manager.postgresInstances().list(com.azure.core.util.Context.NONE); } } ``` -### SqlManagedInstances_ListByResourceGroup +### PostgresInstances_ListByResourceGroup ```java -/** Samples for SqlManagedInstances ListByResourceGroup. */ -public final class SqlManagedInstancesListByResourceGroupSamples { +/** Samples for PostgresInstances ListByResourceGroup. */ +public final class PostgresInstancesListByResourceGroupSamples { /* - * 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-03-15-preview/examples/ListByResourceGroupPostgresInstance.json */ /** - * Sample code: Gets all SQL Instance in a resource group. + * Sample code: Gets all postgres Instances in a resource group. * * @param manager Entry point to AzureArcDataManager. */ - public static void getsAllSQLInstanceInAResourceGroup( + public static void getsAllPostgresInstancesInAResourceGroup( com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager.sqlManagedInstances().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + manager.postgresInstances().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); } } ``` -### SqlManagedInstances_Update +### PostgresInstances_Update ```java -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstance; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstance; import java.util.HashMap; import java.util.Map; -/** Samples for SqlManagedInstances Update. */ -public final class SqlManagedInstancesUpdateSamples { +/** Samples for PostgresInstances Update. */ +public final class PostgresInstancesUpdateSamples { /* - * 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-03-15-preview/examples/UpdatePostgresInstance.json */ /** - * Sample code: Updates a sql Instance tags. + * Sample code: Updates a postgres Instances tags. * * @param manager Entry point to AzureArcDataManager. */ - public static void updatesASqlInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - SqlManagedInstance resource = + public static void updatesAPostgresInstancesTags( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + PostgresInstance resource = manager - .sqlManagedInstances() + .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; + } +} +``` + +### SqlAvailabilityGroupDatabases_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlAvailabilityGroupDatabases Create. */ +public final class SqlAvailabilityGroupDatabasesCreateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/CreateOrUpdateArcSqlAvailabilityGroupDatabase.json + */ + /** + * Sample code: Create a Arc availability group database. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createAArcAvailabilityGroupDatabase( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlAvailabilityGroupDatabases() + .define("testSqlDatabase") + .withRegion("southeastasia") + .withExistingSqlAvailabilityGroup("testrg", "testAG") + .withProperties( + new SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties() + .withGroupDatabaseId("00000000-1111-2222-3333-444444444444") + .withValue( + Arrays + .asList( + new SqlAvailabilityGroupDatabaseReplicaResourceProperties() + .withReplicaName("sqlServer1") + .withIsLocal(true) + .withIsPrimaryReplica(true) + .withSynchronizationStateDesc("SYNCHRONIZED") + .withIsCommitParticipant(true) + .withSynchronizationHealthDesc("HEALTHY") + .withDatabaseStateDesc("ONLINE") + .withIsSuspended(false), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties() + .withReplicaName("sqlServer2") + .withIsLocal(false) + .withIsPrimaryReplica(false) + .withSynchronizationStateDesc("SYNCHRONIZED") + .withIsCommitParticipant(true) + .withSynchronizationHealthDesc("HEALTHY") + .withDatabaseStateDesc("ONLINE") + .withIsSuspended(false)))) + .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; + } +} +``` + +### SqlAvailabilityGroupDatabases_Delete + +```java +/** Samples for SqlAvailabilityGroupDatabases Delete. */ +public final class SqlAvailabilityGroupDatabasesDeleteSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/DeleteArcSqlAvailabilityGroupDatabase.json + */ + /** + * Sample code: Deletes an Arc Sql availability group database resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deletesAnArcSqlAvailabilityGroupDatabaseResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlAvailabilityGroupDatabases() + .deleteWithResponse("testrg", "testSqlDatabase", "testAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlAvailabilityGroupDatabases_Get + +```java +/** Samples for SqlAvailabilityGroupDatabases Get. */ +public final class SqlAvailabilityGroupDatabasesGetSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/GetArcSqlAvailabilityGroupDatabase.json + */ + /** + * Sample code: Retrieves an Arc Sql Server availability group database resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesAnArcSqlServerAvailabilityGroupDatabaseResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlAvailabilityGroupDatabases() + .getWithResponse("testrg", "testSqlDatabase", "testAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlAvailabilityGroupDatabases_List + +```java +/** Samples for SqlAvailabilityGroupDatabases List. */ +public final class SqlAvailabilityGroupDatabasesListSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/ListBySqlAvailabilityGroupDatabase.json + */ + /** + * Sample code: Gets all availability group databases associated with the availability groups . + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllAvailabilityGroupDatabasesAssociatedWithTheAvailabilityGroups( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlAvailabilityGroupDatabases().list("testrg", "testAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlAvailabilityGroupDatabases_Update + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseResource; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlAvailabilityGroupDatabases Update. */ +public final class SqlAvailabilityGroupDatabasesUpdateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/UpdateSqlAvailabilityGroupDatabase.json + */ + /** + * Sample code: Update a availability group replica. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updateAAvailabilityGroupReplica( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlAvailabilityGroupDatabaseResource resource = + manager + .sqlAvailabilityGroupDatabases() + .getWithResponse("testrg", "testSqlDatabase", "testsAG", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("mytag", "myval1")) + .withProperties( + new SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties() + .withGroupDatabaseId("00000000-1111-2222-3333-444444444444") + .withValue( + Arrays + .asList( + new SqlAvailabilityGroupDatabaseReplicaResourceProperties() + .withReplicaName("sqlServer1") + .withIsLocal(true) + .withIsPrimaryReplica(true) + .withSynchronizationStateDesc("SYNCHRONIZED") + .withIsCommitParticipant(true) + .withSynchronizationHealthDesc("HEALTHY") + .withDatabaseStateDesc("ONLINE") + .withIsSuspended(false), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties() + .withReplicaName("sqlServer2") + .withIsLocal(false) + .withIsPrimaryReplica(false) + .withSynchronizationStateDesc("SYNCHRONIZED") + .withIsCommitParticipant(true) + .withSynchronizationHealthDesc("HEALTHY") + .withDatabaseStateDesc("ONLINE") + .withIsSuspended(false)))) + .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; + } +} +``` + +### SqlAvailabilityGroupReplicas_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupConfigure; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupState; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResourceProperties; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlAvailabilityGroupReplicas Create. */ +public final class SqlAvailabilityGroupReplicasCreateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/CreateOrUpdateArcSqlAvailabilityGroupReplica.json + */ + /** + * Sample code: Create a Arc Sql Server availability group replica. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createAArcSqlServerAvailabilityGroupReplica( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlAvailabilityGroupReplicas() + .define("testSqlServerInstance") + .withRegion("southeastasia") + .withExistingSqlAvailabilityGroup("testrg", "testAG") + .withProperties( + new SqlAvailabilityGroupReplicaResourceProperties() + .withReplicaId("00000000-1111-2222-3333-444444444444") + .withReplicaName("testSqlServerInstance") + .withConfigure( + new AvailabilityGroupConfigure() + .withEndpointUrl("TCP://mytest60-0.mytest60-svc:5022") + .withAvailabilityModeDesc("SYNCHRONOUS_COMMIT") + .withFailoverModeDesc("EXTERNAL") + .withSessionTimeout(10) + .withPrimaryRoleAllowConnectionsDesc("ALL") + .withSecondaryRoleAllowConnectionsDesc("ALL") + .withBackupPriority(50) + .withSeedingModeDesc("AUTOMATIC")) + .withState( + new AvailabilityGroupState() + .withAvailabilityGroupReplicaRole("SECONDARY") + .withOperationalStateDesc("ONLINE") + .withRecoveryHealthDesc("ONLINE_IN_PROGRESS") + .withSynchronizationHealthDesc("HEALTHY") + .withConnectedStateDesc("CONNECTED") + .withLastConnectErrorDescription("") + .withLastConnectErrorTimestamp(OffsetDateTime.parse("2022-05-05T16: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; + } +} +``` + +### SqlAvailabilityGroupReplicas_Delete + +```java +/** Samples for SqlAvailabilityGroupReplicas Delete. */ +public final class SqlAvailabilityGroupReplicasDeleteSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/DeleteArcSqlAvailabilityGroupReplica.json + */ + /** + * Sample code: Deletes a availability group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deletesAAvailabilityGroupResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlAvailabilityGroupReplicas() + .deleteWithResponse("testrg", "testsqlManagedInstance", "testAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlAvailabilityGroupReplicas_Get + +```java +/** Samples for SqlAvailabilityGroupReplicas Get. */ +public final class SqlAvailabilityGroupReplicasGetSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/GetArcSqlAvailabilityGroupReplica.json + */ + /** + * Sample code: Retrieves an Arc Sql Server availability group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesAnArcSqlServerAvailabilityGroupResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlAvailabilityGroupReplicas() + .getWithResponse("testrg", "testSqlServerInstance", "testAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlAvailabilityGroupReplicas_List + +```java +/** Samples for SqlAvailabilityGroupReplicas List. */ +public final class SqlAvailabilityGroupReplicasListSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/ListBySqlAvailabilityGroupReplica.json + */ + /** + * Sample code: Gets all availability group replicas associated with the availability groups . + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllAvailabilityGroupReplicasAssociatedWithTheAvailabilityGroups( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlAvailabilityGroupReplicas().list("testrg", "testAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlAvailabilityGroupReplicas_Update + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlAvailabilityGroupReplicas Update. */ +public final class SqlAvailabilityGroupReplicasUpdateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/UpdateSqlAvailabilityGroupReplica.json + */ + /** + * Sample code: Update a availability group replica. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updateAAvailabilityGroupReplica( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlAvailabilityGroupReplicaResource resource = + manager + .sqlAvailabilityGroupReplicas() + .getWithResponse("testrg", "testSqlServerInstance", "testsAG", 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; + } +} +``` + +### SqlAvailabilityGroups_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupProperties; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlAvailabilityGroups Create. */ +public final class SqlAvailabilityGroupsCreateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/CreateOrUpdateSqlAvailabilityGroup.json + */ + /** + * Sample code: Updates a SQL Availability Group tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updatesASQLAvailabilityGroupTags( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlAvailabilityGroups() + .define("testsqlAvailabilityGroup") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withTags(mapOf("mytag", "myval")) + .withProperties( + new SqlAvailabilityGroupProperties() + .withAvailabilityGroupName("myAvailabilityGroup") + .withAvailabilityGroupId("00000000-1111-2222-3333-444444444444") + .withInstanceName("testInstance") + .withCollectionTimestamp(OffsetDateTime.parse("2022-05-05T16:26:33.883Z")) + .withVersion(0) + .withBasicFeatures(false) + .withDtcSupport(false) + .withDbFailover(true) + .withIsDistributed(false) + .withClusterTypeDesc("WSFC") + .withRequiredSynchronizedSecondariesCommit(0) + .withIsContained(false)) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlAvailabilityGroups_Delete + +```java +/** Samples for SqlAvailabilityGroups Delete. */ +public final class SqlAvailabilityGroupsDeleteSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/DeleteSqlAvailabilityGroup.json + */ + /** + * Sample code: Delete a SQL Server Instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deleteASQLServerInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlAvailabilityGroups().delete("testrg", "testsqlAvailabilityGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlAvailabilityGroups_GetByResourceGroup + +```java +/** Samples for SqlAvailabilityGroups GetByResourceGroup. */ +public final class SqlAvailabilityGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/GetSqlAvailabilityGroup.json + */ + /** + * Sample code: Updates a SQL Server Instance tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updatesASQLServerInstanceTags( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlAvailabilityGroups() + .getByResourceGroupWithResponse("testrg", "testsqlAvailabilityGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlAvailabilityGroups_List + +```java +/** Samples for SqlAvailabilityGroups List. */ +public final class SqlAvailabilityGroupsListSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/ListSubscriptionSqlAvailabilityGroup.json + */ + /** + * Sample code: Gets all SQL Availability Groups in a subscription. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllSQLAvailabilityGroupsInASubscription( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlAvailabilityGroups().list(com.azure.core.util.Context.NONE); + } +} +``` + +### SqlAvailabilityGroups_ListByResourceGroup + +```java +/** Samples for SqlAvailabilityGroups ListByResourceGroup. */ +public final class SqlAvailabilityGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/ListByResourceGroupSqlAvailabilityGroup.json + */ + /** + * Sample code: Gets all SQL Server Instance in a resource group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllSQLServerInstanceInAResourceGroup( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlAvailabilityGroups().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlAvailabilityGroups_Update + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroup; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlAvailabilityGroups Update. */ +public final class SqlAvailabilityGroupsUpdateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/UpdateSqlAvailabilityGroup.json + */ + /** + * Sample code: Updates a SQL Server Instance tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updatesASQLServerInstanceTags( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlAvailabilityGroup resource = + manager + .sqlAvailabilityGroups() + .getByResourceGroupWithResponse("testrg", "testsqlAvailabilityGroup", 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.K8SResourceRequirements; +import com.azure.resourcemanager.azurearcdata.models.K8SScheduling; +import com.azure.resourcemanager.azurearcdata.models.K8SSchedulingOptions; +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.HashMap; +import java.util.Map; + +/** Samples for SqlManagedInstances Create. */ +public final class SqlManagedInstancesCreateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/CreateOrUpdateSqlManagedInstance.json + */ + /** + * Sample code: Create or update a SQL Managed Instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createOrUpdateASQLManagedInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlManagedInstances() + .define("testsqlManagedInstance") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withProperties( + new SqlManagedInstanceProperties() + .withAdmin("Admin user") + .withStartTime("Instance start time") + .withEndTime("Instance end time") + .withK8SRaw( + new SqlManagedInstanceK8SRaw() + .withSpec( + new SqlManagedInstanceK8SSpec() + .withScheduling( + new K8SScheduling() + .withDefaultProperty( + new K8SSchedulingOptions() + .withResources( + new K8SResourceRequirements() + .withRequests( + mapOf( + "additionalProperty", + "additionalValue", + "cpu", + "1", + "memory", + "8Gi")) + .withLimits( + mapOf( + "additionalProperty", + "additionalValue", + "cpu", + "1", + "memory", + "8Gi")) + .withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf())) + .withReplicas(1) + .withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf("additionalProperty", 1234))) + .withBasicLoginInformation( + new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withActiveDirectoryInformation( + new ActiveDirectoryInformation() + .withKeytabInformation(new KeytabInformation().withKeytab("fakeTokenPlaceholder"))) + .withLicenseType(ArcSqlManagedInstanceLicenseType.LICENSE_INCLUDED) + .withClusterId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s") + .withExtensionId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension")) + .withTags(mapOf("mytag", "myval")) + .withExtendedLocation( + new ExtendedLocation() + .withName( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .withSku(new SqlManagedInstanceSku().withTier(SqlManagedInstanceSkuTier.GENERAL_PURPOSE).withDev(true)) + .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; + } +} +``` + +### SqlManagedInstances_Delete + +```java +/** Samples for SqlManagedInstances Delete. */ +public final class SqlManagedInstancesDeleteSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/DeleteSqlManagedInstance.json + */ + /** + * Sample code: Delete a SQL Instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deleteASQLInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlManagedInstances().delete("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlManagedInstances_GetByResourceGroup + +```java +/** Samples for SqlManagedInstances GetByResourceGroup. */ +public final class SqlManagedInstancesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/GetSqlManagedInstance.json + */ + /** + * Sample code: Updates a SQL Instance tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updatesASQLInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlManagedInstances() + .getByResourceGroupWithResponse("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlManagedInstances_List + +```java +/** Samples for SqlManagedInstances List. */ +public final class SqlManagedInstancesListSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/ListSubscriptionSqlManagedInstance.json + */ + /** + * Sample code: Gets all SQL Instance in a subscription. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllSQLInstanceInASubscription( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlManagedInstances().list(com.azure.core.util.Context.NONE); + } +} +``` + +### SqlManagedInstances_ListByResourceGroup + +```java +/** Samples for SqlManagedInstances ListByResourceGroup. */ +public final class SqlManagedInstancesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/ListByResourceGroupSqlManagedInstance.json + */ + /** + * Sample code: Gets all SQL Instance in a resource group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllSQLInstanceInAResourceGroup( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlManagedInstances().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlManagedInstances_Update + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstance; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlManagedInstances Update. */ +public final class SqlManagedInstancesUpdateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/UpdateSqlManagedInstance.json + */ + /** + * Sample code: Updates a sql Instance tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updatesASqlInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlManagedInstance resource = + manager + .sqlManagedInstances() .getByResourceGroupWithResponse("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE) .getValue(); resource.update().withTags(mapOf("mytag", "myval")).apply(); @@ -475,6 +1513,348 @@ public final class SqlManagedInstancesUpdateSamples { } ``` +### SqlServerAvailabilityGroups_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupConfigure; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupState; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourceProperties; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlServerAvailabilityGroups Create. */ +public final class SqlServerAvailabilityGroupsCreateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/CreateOrUpdateArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Create a Arc Sql Server availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createAArcSqlServerAvailabilityGroup( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlServerAvailabilityGroups() + .define("testAG") + .withRegion("southeastasia") + .withExistingSqlServerInstance("testrg", "testSqlServerInstance") + .withProperties( + new SqlServerAvailabilityGroupResourceProperties() + .withAvailabilityGroupId("00000000-1111-2222-3333-444444444444") + .withAvailabilityGroupName("testAG") + .withConfigure( + new AvailabilityGroupConfigure() + .withEndpointUrl("TCP://mytest60-0.mytest60-svc:5022") + .withAvailabilityModeDesc("SYNCHRONOUS_COMMIT") + .withFailoverModeDesc("EXTERNAL") + .withSessionTimeout(10) + .withPrimaryRoleAllowConnectionsDesc("ALL") + .withSecondaryRoleAllowConnectionsDesc("ALL") + .withBackupPriority(50) + .withSeedingModeDesc("AUTOMATIC")) + .withState( + new AvailabilityGroupState() + .withAvailabilityGroupReplicaRole("SECONDARY") + .withOperationalStateDesc("ONLINE") + .withRecoveryHealthDesc("ONLINE_IN_PROGRESS") + .withSynchronizationHealthDesc("HEALTHY") + .withConnectedStateDesc("CONNECTED") + .withLastConnectErrorDescription("") + .withLastConnectErrorTimestamp(OffsetDateTime.parse("2022-05-05T16: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; + } +} +``` + +### SqlServerAvailabilityGroups_Delete + +```java +/** Samples for SqlServerAvailabilityGroups Delete. */ +public final class SqlServerAvailabilityGroupsDeleteSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/DeleteArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Deletes a availability group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deletesAAvailabilityGroupResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlServerAvailabilityGroups() + .deleteWithResponse( + "testrg", "testsqlInstanceAvailabilityGroup", "testAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_Get + +```java +/** Samples for SqlServerAvailabilityGroups Get. */ +public final class SqlServerAvailabilityGroupsGetSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/GetArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Retrieves an Arc Sql Server availability group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesAnArcSqlServerAvailabilityGroupResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlServerAvailabilityGroups() + .getWithResponse("testrg", "testSqlServerInstance", "testAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_List + +```java +/** Samples for SqlServerAvailabilityGroups List. */ +public final class SqlServerAvailabilityGroupsListSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/ListBySqlServerInstanceAvailabilityGroup.json + */ + /** + * Sample code: Gets all availability groups associated with an Arc Enabled Sql server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllAvailabilityGroupsAssociatedWithAnArcEnabledSqlServer( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups().list("testrg", "testSqlServerInstance", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_Update + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlServerAvailabilityGroups Update. */ +public final class SqlServerAvailabilityGroupsUpdateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/UpdateSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Update a availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updateAAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerAvailabilityGroupResource resource = + manager + .sqlServerAvailabilityGroups() + .getWithResponse("testrg", "testSqlServerInstance", "testAG", 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; + } +} +``` + +### 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-03-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-03-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-03-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-03-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-03-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 +1862,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 +1872,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-03-15-preview/examples/CreateOrUpdateSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. @@ -508,21 +1889,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 +1928,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-03-15-preview/examples/DeleteSqlServerInstance.json */ /** * Sample code: Delete a SQL Server Instance. @@ -564,7 +1947,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-03-15-preview/examples/GetSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. @@ -586,7 +1969,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-03-15-preview/examples/ListSubscriptionSqlServerInstance.json */ /** * Sample code: Gets all SQL Server Instance in a subscription. @@ -606,7 +1989,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-03-15-preview/examples/ListByResourceGroupSqlServerInstance.json */ /** * Sample code: Gets all SQL Server Instance in a resource group. @@ -630,7 +2013,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-03-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 7ee2436bab7f..cfc57a40b95e 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-03. 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..3e35e138d956 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,30 @@ 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.SqlAvailabilityGroupDatabasesImpl; +import com.azure.resourcemanager.azurearcdata.implementation.SqlAvailabilityGroupReplicasImpl; +import com.azure.resourcemanager.azurearcdata.implementation.SqlAvailabilityGroupsImpl; import com.azure.resourcemanager.azurearcdata.implementation.SqlManagedInstancesImpl; +import com.azure.resourcemanager.azurearcdata.implementation.SqlServerAvailabilityGroupsImpl; +import com.azure.resourcemanager.azurearcdata.implementation.SqlServerDatabasesImpl; import com.azure.resourcemanager.azurearcdata.implementation.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.SqlAvailabilityGroupDatabases; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicas; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroups; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstances; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroups; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabases; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstances; import java.time.Duration; import java.time.temporal.ChronoUnit; @@ -49,10 +65,26 @@ public final class AzureArcDataManager { private SqlManagedInstances sqlManagedInstances; + private FailoverGroups failoverGroups; + private SqlServerInstances sqlServerInstances; + private SqlAvailabilityGroups sqlAvailabilityGroups; + private DataControllers dataControllers; + private ActiveDirectoryConnectors activeDirectoryConnectors; + + private PostgresInstances postgresInstances; + + private SqlServerDatabases sqlServerDatabases; + + private SqlServerAvailabilityGroups sqlServerAvailabilityGroups; + + private SqlAvailabilityGroupReplicas sqlAvailabilityGroupReplicas; + + private SqlAvailabilityGroupDatabases sqlAvailabilityGroupDatabases; + private final AzureArcDataManagementClient clientObject; private AzureArcDataManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -218,7 +250,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 +331,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. * @@ -311,6 +355,18 @@ public SqlServerInstances sqlServerInstances() { return sqlServerInstances; } + /** + * Gets the resource collection API of SqlAvailabilityGroups. It manages SqlAvailabilityGroup. + * + * @return Resource collection API of SqlAvailabilityGroups. + */ + public SqlAvailabilityGroups sqlAvailabilityGroups() { + if (this.sqlAvailabilityGroups == null) { + this.sqlAvailabilityGroups = new SqlAvailabilityGroupsImpl(clientObject.getSqlAvailabilityGroups(), this); + } + return sqlAvailabilityGroups; + } + /** * Gets the resource collection API of DataControllers. It manages DataControllerResource. * @@ -323,6 +379,83 @@ 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; + } + + /** + * Gets the resource collection API of SqlServerAvailabilityGroups. It manages SqlServerAvailabilityGroupResource. + * + * @return Resource collection API of SqlServerAvailabilityGroups. + */ + public SqlServerAvailabilityGroups sqlServerAvailabilityGroups() { + if (this.sqlServerAvailabilityGroups == null) { + this.sqlServerAvailabilityGroups = + new SqlServerAvailabilityGroupsImpl(clientObject.getSqlServerAvailabilityGroups(), this); + } + return sqlServerAvailabilityGroups; + } + + /** + * Gets the resource collection API of SqlAvailabilityGroupReplicas. It manages SqlAvailabilityGroupReplicaResource. + * + * @return Resource collection API of SqlAvailabilityGroupReplicas. + */ + public SqlAvailabilityGroupReplicas sqlAvailabilityGroupReplicas() { + if (this.sqlAvailabilityGroupReplicas == null) { + this.sqlAvailabilityGroupReplicas = + new SqlAvailabilityGroupReplicasImpl(clientObject.getSqlAvailabilityGroupReplicas(), this); + } + return sqlAvailabilityGroupReplicas; + } + + /** + * Gets the resource collection API of SqlAvailabilityGroupDatabases. It manages + * SqlAvailabilityGroupDatabaseResource. + * + * @return Resource collection API of SqlAvailabilityGroupDatabases. + */ + public SqlAvailabilityGroupDatabases sqlAvailabilityGroupDatabases() { + if (this.sqlAvailabilityGroupDatabases == null) { + this.sqlAvailabilityGroupDatabases = + new SqlAvailabilityGroupDatabasesImpl(clientObject.getSqlAvailabilityGroupDatabases(), this); + } + return sqlAvailabilityGroupDatabases; + } + /** * @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..82225ff3e769 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. * @@ -65,10 +72,59 @@ public interface AzureArcDataManagementClient { */ SqlServerInstancesClient getSqlServerInstances(); + /** + * Gets the SqlAvailabilityGroupsClient object to access its operations. + * + * @return the SqlAvailabilityGroupsClient object. + */ + SqlAvailabilityGroupsClient getSqlAvailabilityGroups(); + /** * Gets the DataControllersClient object to access its operations. * * @return the DataControllersClient object. */ DataControllersClient getDataControllers(); + + /** + * Gets the ActiveDirectoryConnectorsClient object to access its operations. + * + * @return the ActiveDirectoryConnectorsClient object. + */ + ActiveDirectoryConnectorsClient getActiveDirectoryConnectors(); + + /** + * Gets the PostgresInstancesClient object to access its operations. + * + * @return the PostgresInstancesClient object. + */ + PostgresInstancesClient getPostgresInstances(); + + /** + * Gets the SqlServerDatabasesClient object to access its operations. + * + * @return the SqlServerDatabasesClient object. + */ + SqlServerDatabasesClient getSqlServerDatabases(); + + /** + * Gets the SqlServerAvailabilityGroupsClient object to access its operations. + * + * @return the SqlServerAvailabilityGroupsClient object. + */ + SqlServerAvailabilityGroupsClient getSqlServerAvailabilityGroups(); + + /** + * Gets the SqlAvailabilityGroupReplicasClient object to access its operations. + * + * @return the SqlAvailabilityGroupReplicasClient object. + */ + SqlAvailabilityGroupReplicasClient getSqlAvailabilityGroupReplicas(); + + /** + * Gets the SqlAvailabilityGroupDatabasesClient object to access its operations. + * + * @return the SqlAvailabilityGroupDatabasesClient object. + */ + SqlAvailabilityGroupDatabasesClient getSqlAvailabilityGroupDatabases(); } 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/SqlAvailabilityGroupDatabasesClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlAvailabilityGroupDatabasesClient.java new file mode 100644 index 000000000000..10ab49b7e80e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlAvailabilityGroupDatabasesClient.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.SqlAvailabilityGroupDatabaseResourceInner; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseUpdate; + +/** An instance of this class provides access to all the operations defined in SqlAvailabilityGroupDatabasesClient. */ +public interface SqlAvailabilityGroupDatabasesClient { + /** + * Creates or update database in an Arc Sql Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupDatabaseResource The request body for availability group databases resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group Database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupDatabaseResourceInner sqlAvailabilityGroupDatabaseResource, + Context context); + + /** + * Creates or update database in an Arc Sql Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupDatabaseResource The request body for availability group databases resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlAvailabilityGroupDatabaseResourceInner create( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupDatabaseResourceInner sqlAvailabilityGroupDatabaseResource); + + /** + * Deletes an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + Context context); + + /** + * Deletes an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlAvailabilityGroupDatabaseName, String sqlAvailabilityGroupName); + + /** + * Retrieves an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group Database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + Context context); + + /** + * Retrieves an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlAvailabilityGroupDatabaseResourceInner get( + String resourceGroupName, String sqlAvailabilityGroupDatabaseName, String sqlAvailabilityGroupName); + + /** + * Updates an existing Availability Group Database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupDatabaseUpdate The update availability group 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 Availability Group Database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupDatabaseUpdate sqlAvailabilityGroupDatabaseUpdate, + Context context); + + /** + * Updates an existing Availability Group Database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupDatabaseUpdate The update availability group 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 Availability Group Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlAvailabilityGroupDatabaseResourceInner update( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupDatabaseUpdate sqlAvailabilityGroupDatabaseUpdate); + + /** + * List the Availability Group Databases associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String sqlAvailabilityGroupName); + + /** + * List the Availability Group Databases associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String sqlAvailabilityGroupName, Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlAvailabilityGroupReplicasClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlAvailabilityGroupReplicasClient.java new file mode 100644 index 000000000000..3e873a749ab1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlAvailabilityGroupReplicasClient.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlAvailabilityGroupReplicaResourceInner; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaUpdate; + +/** An instance of this class provides access to all the operations defined in SqlAvailabilityGroupReplicasClient. */ +public interface SqlAvailabilityGroupReplicasClient { + /** + * Creates or replaces an Arc Sql Availability Group Replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupReplicaResource The request body for availability group replica resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupReplicaResourceInner sqlAvailabilityGroupReplicaResource, + Context context); + + /** + * Creates or replaces an Arc Sql Availability Group Replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupReplicaResource The request body for availability group replica resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlAvailabilityGroupReplicaResourceInner create( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupReplicaResourceInner sqlAvailabilityGroupReplicaResource); + + /** + * Deletes an Arc Sql availability group replica resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, Context context); + + /** + * Deletes an Arc Sql availability group replica resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName); + + /** + * Retrieves an Arc Sql availability group replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, Context context); + + /** + * Retrieves an Arc Sql availability group replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlAvailabilityGroupReplicaResourceInner get( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName); + + /** + * Updates an existing Availability Group Replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupReplicaUpdate The requested availability group replica resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupReplicaUpdate sqlAvailabilityGroupReplicaUpdate, + Context context); + + /** + * Updates an existing Availability Group Replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupReplicaUpdate The requested availability group replica resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlAvailabilityGroupReplicaResourceInner update( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupReplicaUpdate sqlAvailabilityGroupReplicaUpdate); + + /** + * List the Availability Group Replica associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Replica as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String sqlAvailabilityGroupName); + + /** + * List the Availability Group Replica associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Replica as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String sqlAvailabilityGroupName, Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlAvailabilityGroupsClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlAvailabilityGroupsClient.java new file mode 100644 index 000000000000..d2b3565d82a0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlAvailabilityGroupsClient.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.SqlAvailabilityGroupInner; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupUpdate; + +/** An instance of this class provides access to all the operations defined in SqlAvailabilityGroupsClient. */ +public interface SqlAvailabilityGroupsClient { + /** + * List sqlAvailabilityGroups 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 SqlAvailabilityGroup as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List sqlAvailabilityGroups 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 SqlAvailabilityGroup as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List sqlAvailabilityGroups resources in the resource group + * + *

Gets all sqlAvailabilityGroups in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlAvailabilityGroups in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List sqlAvailabilityGroups resources in the resource group + * + *

Gets all sqlAvailabilityGroups in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlAvailabilityGroups in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieves a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String sqlAvailabilityGroupName, Context context); + + /** + * Retrieves a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlAvailabilityGroupInner getByResourceGroup(String resourceGroupName, String sqlAvailabilityGroupName); + + /** + * Creates or replaces a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroup The SQL Availability Group to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a SqlAvailabilityGroup. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlAvailabilityGroupInner> beginCreate( + String resourceGroupName, String sqlAvailabilityGroupName, SqlAvailabilityGroupInner sqlAvailabilityGroup); + + /** + * Creates or replaces a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroup The SQL Availability Group to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a SqlAvailabilityGroup. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlAvailabilityGroupInner> beginCreate( + String resourceGroupName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupInner sqlAvailabilityGroup, + Context context); + + /** + * Creates or replaces a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroup The SQL Availability Group to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlAvailabilityGroupInner create( + String resourceGroupName, String sqlAvailabilityGroupName, SqlAvailabilityGroupInner sqlAvailabilityGroup); + + /** + * Creates or replaces a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroup The SQL Availability Group to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlAvailabilityGroupInner create( + String resourceGroupName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupInner sqlAvailabilityGroup, + Context context); + + /** + * Deletes a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String sqlAvailabilityGroupName); + + /** + * Deletes a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String sqlAvailabilityGroupName, Context context); + + /** + * Deletes a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlAvailabilityGroupName); + + /** + * Deletes a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlAvailabilityGroupName, Context context); + + /** + * Updates a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param parameters The SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupUpdate parameters, + Context context); + + /** + * Updates a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param parameters The SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlAvailabilityGroupInner update( + String resourceGroupName, String sqlAvailabilityGroupName, SqlAvailabilityGroupUpdate 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/SqlServerAvailabilityGroupsClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerAvailabilityGroupsClient.java new file mode 100644 index 000000000000..f91675d44521 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerAvailabilityGroupsClient.java @@ -0,0 +1,184 @@ +// Copyright (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.SqlServerAvailabilityGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupUpdate; + +/** An instance of this class provides access to all the operations defined in SqlServerAvailabilityGroupsClient. */ +public interface SqlServerAvailabilityGroupsClient { + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource, + Context context); + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner create( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, Context context); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, Context context); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner get( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName); + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, + Context context); + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner update( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate); + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String sqlServerInstanceName); + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String sqlServerInstanceName, Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerDatabasesClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerDatabasesClient.java new file mode 100644 index 000000000000..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/SqlAvailabilityGroupDatabaseResourceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlAvailabilityGroupDatabaseResourceInner.java new file mode 100644 index 000000000000..cdb4daef194f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlAvailabilityGroupDatabaseResourceInner.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.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.SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Arc Sql Server Availability Group Database. */ +@Fluent +public final class SqlAvailabilityGroupDatabaseResourceInner extends Resource { + /* + * Properties of Arc Sql Availability Group Multiple Database Replica + */ + @JsonProperty(value = "properties", required = true) + private SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties 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 SqlAvailabilityGroupDatabaseResourceInner class. */ + public SqlAvailabilityGroupDatabaseResourceInner() { + } + + /** + * Get the properties property: Properties of Arc Sql Availability Group Multiple Database Replica. + * + * @return the properties value. + */ + public SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of Arc Sql Availability Group Multiple Database Replica. + * + * @param properties the properties value to set. + * @return the SqlAvailabilityGroupDatabaseResourceInner object itself. + */ + public SqlAvailabilityGroupDatabaseResourceInner withProperties( + SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties 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 SqlAvailabilityGroupDatabaseResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlAvailabilityGroupDatabaseResourceInner 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 SqlAvailabilityGroupDatabaseResourceInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlAvailabilityGroupDatabaseResourceInner.class); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlAvailabilityGroupInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlAvailabilityGroupInner.java new file mode 100644 index 000000000000..066200de2d39 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlAvailabilityGroupInner.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A SqlAvailabilityGroup. */ +@Fluent +public final class SqlAvailabilityGroupInner extends Resource { + /* + * null + */ + @JsonProperty(value = "properties") + private SqlAvailabilityGroupProperties 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 SqlAvailabilityGroupInner class. */ + public SqlAvailabilityGroupInner() { + } + + /** + * Get the properties property: null. + * + * @return the properties value. + */ + public SqlAvailabilityGroupProperties properties() { + return this.properties; + } + + /** + * Set the properties property: null. + * + * @param properties the properties value to set. + * @return the SqlAvailabilityGroupInner object itself. + */ + public SqlAvailabilityGroupInner withProperties(SqlAvailabilityGroupProperties 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 SqlAvailabilityGroupInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlAvailabilityGroupInner 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) { + properties().validate(); + } + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlAvailabilityGroupReplicaResourceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlAvailabilityGroupReplicaResourceInner.java new file mode 100644 index 000000000000..2e6b15bc49e4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlAvailabilityGroupReplicaResourceInner.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.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.SqlAvailabilityGroupReplicaResourceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Arc Sql Server Availability Group. */ +@Fluent +public final class SqlAvailabilityGroupReplicaResourceInner extends Resource { + /* + * Properties of Arc Sql Availability Group Replica + */ + @JsonProperty(value = "properties", required = true) + private SqlAvailabilityGroupReplicaResourceProperties 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 SqlAvailabilityGroupReplicaResourceInner class. */ + public SqlAvailabilityGroupReplicaResourceInner() { + } + + /** + * Get the properties property: Properties of Arc Sql Availability Group Replica. + * + * @return the properties value. + */ + public SqlAvailabilityGroupReplicaResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of Arc Sql Availability Group Replica. + * + * @param properties the properties value to set. + * @return the SqlAvailabilityGroupReplicaResourceInner object itself. + */ + public SqlAvailabilityGroupReplicaResourceInner withProperties( + SqlAvailabilityGroupReplicaResourceProperties 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 SqlAvailabilityGroupReplicaResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlAvailabilityGroupReplicaResourceInner 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 SqlAvailabilityGroupReplicaResourceInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlAvailabilityGroupReplicaResourceInner.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/SqlServerAvailabilityGroupResourceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerAvailabilityGroupResourceInner.java new file mode 100644 index 000000000000..107d7fe051d4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerAvailabilityGroupResourceInner.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.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.SqlServerAvailabilityGroupResourceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Arc Sql Server Availability Group. */ +@Fluent +public final class SqlServerAvailabilityGroupResourceInner extends Resource { + /* + * Properties of Arc Sql Server availability group + */ + @JsonProperty(value = "properties", required = true) + private SqlServerAvailabilityGroupResourceProperties 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 SqlServerAvailabilityGroupResourceInner class. */ + public SqlServerAvailabilityGroupResourceInner() { + } + + /** + * Get the properties property: Properties of Arc Sql Server availability group. + * + * @return the properties value. + */ + public SqlServerAvailabilityGroupResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of Arc Sql Server availability group. + * + * @param properties the properties value to set. + * @return the SqlServerAvailabilityGroupResourceInner object itself. + */ + public SqlServerAvailabilityGroupResourceInner withProperties( + SqlServerAvailabilityGroupResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public SqlServerAvailabilityGroupResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlServerAvailabilityGroupResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property properties in model SqlServerAvailabilityGroupResourceInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlServerAvailabilityGroupResourceInner.class); +} 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..64666d454a6e 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,18 @@ import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.azurearcdata.fluent.ActiveDirectoryConnectorsClient; import com.azure.resourcemanager.azurearcdata.fluent.AzureArcDataManagementClient; import com.azure.resourcemanager.azurearcdata.fluent.DataControllersClient; +import com.azure.resourcemanager.azurearcdata.fluent.FailoverGroupsClient; import com.azure.resourcemanager.azurearcdata.fluent.OperationsClient; +import com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient; +import com.azure.resourcemanager.azurearcdata.fluent.SqlAvailabilityGroupDatabasesClient; +import com.azure.resourcemanager.azurearcdata.fluent.SqlAvailabilityGroupReplicasClient; +import com.azure.resourcemanager.azurearcdata.fluent.SqlAvailabilityGroupsClient; import com.azure.resourcemanager.azurearcdata.fluent.SqlManagedInstancesClient; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerDatabasesClient; import com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient; import java.io.IOException; import java.lang.reflect.Type; @@ -135,6 +143,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; @@ -147,6 +167,18 @@ public SqlServerInstancesClient getSqlServerInstances() { return this.sqlServerInstances; } + /** The SqlAvailabilityGroupsClient object to access its operations. */ + private final SqlAvailabilityGroupsClient sqlAvailabilityGroups; + + /** + * Gets the SqlAvailabilityGroupsClient object to access its operations. + * + * @return the SqlAvailabilityGroupsClient object. + */ + public SqlAvailabilityGroupsClient getSqlAvailabilityGroups() { + return this.sqlAvailabilityGroups; + } + /** The DataControllersClient object to access its operations. */ private final DataControllersClient dataControllers; @@ -159,6 +191,78 @@ 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; + } + + /** The SqlServerAvailabilityGroupsClient object to access its operations. */ + private final SqlServerAvailabilityGroupsClient sqlServerAvailabilityGroups; + + /** + * Gets the SqlServerAvailabilityGroupsClient object to access its operations. + * + * @return the SqlServerAvailabilityGroupsClient object. + */ + public SqlServerAvailabilityGroupsClient getSqlServerAvailabilityGroups() { + return this.sqlServerAvailabilityGroups; + } + + /** The SqlAvailabilityGroupReplicasClient object to access its operations. */ + private final SqlAvailabilityGroupReplicasClient sqlAvailabilityGroupReplicas; + + /** + * Gets the SqlAvailabilityGroupReplicasClient object to access its operations. + * + * @return the SqlAvailabilityGroupReplicasClient object. + */ + public SqlAvailabilityGroupReplicasClient getSqlAvailabilityGroupReplicas() { + return this.sqlAvailabilityGroupReplicas; + } + + /** The SqlAvailabilityGroupDatabasesClient object to access its operations. */ + private final SqlAvailabilityGroupDatabasesClient sqlAvailabilityGroupDatabases; + + /** + * Gets the SqlAvailabilityGroupDatabasesClient object to access its operations. + * + * @return the SqlAvailabilityGroupDatabasesClient object. + */ + public SqlAvailabilityGroupDatabasesClient getSqlAvailabilityGroupDatabases() { + return this.sqlAvailabilityGroupDatabases; + } + /** * Initializes an instance of AzureArcDataManagementClient client. * @@ -181,11 +285,19 @@ public DataControllersClient getDataControllers() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2021-08-01"; + this.apiVersion = "2023-03-15-preview"; this.operations = new OperationsClientImpl(this); this.sqlManagedInstances = new SqlManagedInstancesClientImpl(this); + this.failoverGroups = new FailoverGroupsClientImpl(this); this.sqlServerInstances = new SqlServerInstancesClientImpl(this); + this.sqlAvailabilityGroups = new SqlAvailabilityGroupsClientImpl(this); this.dataControllers = new DataControllersClientImpl(this); + this.activeDirectoryConnectors = new ActiveDirectoryConnectorsClientImpl(this); + this.postgresInstances = new PostgresInstancesClientImpl(this); + this.sqlServerDatabases = new SqlServerDatabasesClientImpl(this); + this.sqlServerAvailabilityGroups = new SqlServerAvailabilityGroupsClientImpl(this); + this.sqlAvailabilityGroupReplicas = new SqlAvailabilityGroupReplicasClientImpl(this); + this.sqlAvailabilityGroupDatabases = new SqlAvailabilityGroupDatabasesClientImpl(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/SqlAvailabilityGroupDatabaseResourceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupDatabaseResourceImpl.java new file mode 100644 index 000000000000..df98193c40f1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupDatabaseResourceImpl.java @@ -0,0 +1,230 @@ +// Copyright (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.SqlAvailabilityGroupDatabaseResourceInner; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseResource; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseUpdate; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties; +import java.util.Collections; +import java.util.Map; + +public final class SqlAvailabilityGroupDatabaseResourceImpl + implements SqlAvailabilityGroupDatabaseResource, + SqlAvailabilityGroupDatabaseResource.Definition, + SqlAvailabilityGroupDatabaseResource.Update { + private SqlAvailabilityGroupDatabaseResourceInner 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 SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties 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 SqlAvailabilityGroupDatabaseResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sqlAvailabilityGroupDatabaseName; + + private String sqlAvailabilityGroupName; + + private SqlAvailabilityGroupDatabaseUpdate updateSqlAvailabilityGroupDatabaseUpdate; + + public SqlAvailabilityGroupDatabaseResourceImpl withExistingSqlAvailabilityGroup( + String resourceGroupName, String sqlAvailabilityGroupName) { + this.resourceGroupName = resourceGroupName; + this.sqlAvailabilityGroupName = sqlAvailabilityGroupName; + return this; + } + + public SqlAvailabilityGroupDatabaseResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroupDatabases() + .createWithResponse( + resourceGroupName, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public SqlAvailabilityGroupDatabaseResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroupDatabases() + .createWithResponse( + resourceGroupName, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + this.innerModel(), + context) + .getValue(); + return this; + } + + SqlAvailabilityGroupDatabaseResourceImpl( + String name, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new SqlAvailabilityGroupDatabaseResourceInner(); + this.serviceManager = serviceManager; + this.sqlAvailabilityGroupDatabaseName = name; + } + + public SqlAvailabilityGroupDatabaseResourceImpl update() { + this.updateSqlAvailabilityGroupDatabaseUpdate = new SqlAvailabilityGroupDatabaseUpdate(); + return this; + } + + public SqlAvailabilityGroupDatabaseResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroupDatabases() + .updateWithResponse( + resourceGroupName, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + updateSqlAvailabilityGroupDatabaseUpdate, + Context.NONE) + .getValue(); + return this; + } + + public SqlAvailabilityGroupDatabaseResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroupDatabases() + .updateWithResponse( + resourceGroupName, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + updateSqlAvailabilityGroupDatabaseUpdate, + context) + .getValue(); + return this; + } + + SqlAvailabilityGroupDatabaseResourceImpl( + SqlAvailabilityGroupDatabaseResourceInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.sqlAvailabilityGroupDatabaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.sqlAvailabilityGroupName = Utils.getValueFromIdByName(innerObject.id(), "sqlAvailabilityGroups"); + } + + public SqlAvailabilityGroupDatabaseResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroupDatabases() + .getWithResponse( + resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName, Context.NONE) + .getValue(); + return this; + } + + public SqlAvailabilityGroupDatabaseResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroupDatabases() + .getWithResponse(resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName, context) + .getValue(); + return this; + } + + public SqlAvailabilityGroupDatabaseResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SqlAvailabilityGroupDatabaseResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SqlAvailabilityGroupDatabaseResourceImpl withProperties( + SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties properties) { + if (isInCreateMode()) { + this.innerModel().withProperties(properties); + return this; + } else { + this.updateSqlAvailabilityGroupDatabaseUpdate.withProperties(properties); + return this; + } + } + + public SqlAvailabilityGroupDatabaseResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateSqlAvailabilityGroupDatabaseUpdate.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/SqlAvailabilityGroupDatabasesClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupDatabasesClientImpl.java new file mode 100644 index 000000000000..3990dbf2c591 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupDatabasesClientImpl.java @@ -0,0 +1,1222 @@ +// Copyright (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.SqlAvailabilityGroupDatabasesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlAvailabilityGroupDatabaseResourceInner; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlAvailabilityGroupDatabasesListResult; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SqlAvailabilityGroupDatabasesClient. */ +public final class SqlAvailabilityGroupDatabasesClientImpl implements SqlAvailabilityGroupDatabasesClient { + /** The proxy service used to perform REST calls. */ + private final SqlAvailabilityGroupDatabasesService service; + + /** The service client containing this operation class. */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of SqlAvailabilityGroupDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlAvailabilityGroupDatabasesClientImpl(AzureArcDataManagementClientImpl client) { + this.service = + RestProxy + .create( + SqlAvailabilityGroupDatabasesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientSqlAvailabilityGroupDatabases to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureArcDataManageme") + public interface SqlAvailabilityGroupDatabasesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/databases/{sqlAvailabilityGroupDatabaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlAvailabilityGroupDatabaseName") String sqlAvailabilityGroupDatabaseName, + @PathParam("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") + SqlAvailabilityGroupDatabaseResourceInner sqlAvailabilityGroupDatabaseResource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/databases/{sqlAvailabilityGroupDatabaseName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlAvailabilityGroupDatabaseName") String sqlAvailabilityGroupDatabaseName, + @PathParam("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/databases/{sqlAvailabilityGroupDatabaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlAvailabilityGroupDatabaseName") String sqlAvailabilityGroupDatabaseName, + @PathParam("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/databases/{sqlAvailabilityGroupDatabaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlAvailabilityGroupDatabaseName") String sqlAvailabilityGroupDatabaseName, + @PathParam("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlAvailabilityGroupDatabaseUpdate sqlAvailabilityGroupDatabaseUpdate, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/databases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @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 update database in an Arc Sql Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupDatabaseResource The request body for availability group databases resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group Database along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupDatabaseResourceInner sqlAvailabilityGroupDatabaseResource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlAvailabilityGroupDatabaseName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupDatabaseResource == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlAvailabilityGroupDatabaseResource is required and cannot be null.")); + } else { + sqlAvailabilityGroupDatabaseResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + sqlAvailabilityGroupDatabaseResource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or update database in an Arc Sql Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupDatabaseResource The request body for availability group databases resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group Database along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupDatabaseResourceInner sqlAvailabilityGroupDatabaseResource, + 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 (sqlAvailabilityGroupDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlAvailabilityGroupDatabaseName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupDatabaseResource == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlAvailabilityGroupDatabaseResource is required and cannot be null.")); + } else { + sqlAvailabilityGroupDatabaseResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + sqlAvailabilityGroupDatabaseResource, + accept, + context); + } + + /** + * Creates or update database in an Arc Sql Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupDatabaseResource The request body for availability group databases resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group Database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupDatabaseResourceInner sqlAvailabilityGroupDatabaseResource) { + return createWithResponseAsync( + resourceGroupName, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + sqlAvailabilityGroupDatabaseResource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or update database in an Arc Sql Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupDatabaseResource The request body for availability group databases resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group Database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupDatabaseResourceInner sqlAvailabilityGroupDatabaseResource, + Context context) { + return createWithResponseAsync( + resourceGroupName, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + sqlAvailabilityGroupDatabaseResource, + context) + .block(); + } + + /** + * Creates or update database in an Arc Sql Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupDatabaseResource The request body for availability group databases resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlAvailabilityGroupDatabaseResourceInner create( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupDatabaseResourceInner sqlAvailabilityGroupDatabaseResource) { + return createWithResponse( + resourceGroupName, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + sqlAvailabilityGroupDatabaseResource, + Context.NONE) + .getValue(); + } + + /** + * Deletes an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String sqlAvailabilityGroupDatabaseName, String sqlAvailabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlAvailabilityGroupDatabaseName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + 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 (sqlAvailabilityGroupDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlAvailabilityGroupDatabaseName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName 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, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String sqlAvailabilityGroupDatabaseName, String sqlAvailabilityGroupName) { + return deleteWithResponseAsync(resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName, context) + .block(); + } + + /** + * Deletes an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String sqlAvailabilityGroupDatabaseName, String sqlAvailabilityGroupName) { + deleteWithResponse(resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName, Context.NONE); + } + + /** + * Retrieves an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group Database along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String sqlAvailabilityGroupDatabaseName, String sqlAvailabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlAvailabilityGroupDatabaseName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group Database along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + 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 (sqlAvailabilityGroupDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlAvailabilityGroupDatabaseName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName 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, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Retrieves an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group Database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String sqlAvailabilityGroupDatabaseName, String sqlAvailabilityGroupName) { + return getWithResponseAsync(resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group Database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + Context context) { + return getWithResponseAsync( + resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName, context) + .block(); + } + + /** + * Retrieves an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlAvailabilityGroupDatabaseResourceInner get( + String resourceGroupName, String sqlAvailabilityGroupDatabaseName, String sqlAvailabilityGroupName) { + return getWithResponse( + resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName, Context.NONE) + .getValue(); + } + + /** + * Updates an existing Availability Group Database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupDatabaseUpdate The update availability group 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 Availability Group Database along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupDatabaseUpdate sqlAvailabilityGroupDatabaseUpdate) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlAvailabilityGroupDatabaseName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupDatabaseUpdate == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlAvailabilityGroupDatabaseUpdate is required and cannot be null.")); + } else { + sqlAvailabilityGroupDatabaseUpdate.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + sqlAvailabilityGroupDatabaseUpdate, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing Availability Group Database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupDatabaseUpdate The update availability group 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 Availability Group Database along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupDatabaseUpdate sqlAvailabilityGroupDatabaseUpdate, + 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 (sqlAvailabilityGroupDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlAvailabilityGroupDatabaseName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupDatabaseUpdate == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlAvailabilityGroupDatabaseUpdate is required and cannot be null.")); + } else { + sqlAvailabilityGroupDatabaseUpdate.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + sqlAvailabilityGroupDatabaseUpdate, + accept, + context); + } + + /** + * Updates an existing Availability Group Database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupDatabaseUpdate The update availability group 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 Availability Group Database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupDatabaseUpdate sqlAvailabilityGroupDatabaseUpdate) { + return updateWithResponseAsync( + resourceGroupName, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + sqlAvailabilityGroupDatabaseUpdate) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates an existing Availability Group Database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupDatabaseUpdate The update availability group 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 Availability Group Database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupDatabaseUpdate sqlAvailabilityGroupDatabaseUpdate, + Context context) { + return updateWithResponseAsync( + resourceGroupName, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + sqlAvailabilityGroupDatabaseUpdate, + context) + .block(); + } + + /** + * Updates an existing Availability Group Database. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupDatabaseUpdate The update availability group 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 Availability Group Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlAvailabilityGroupDatabaseResourceInner update( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupDatabaseUpdate sqlAvailabilityGroupDatabaseUpdate) { + return updateWithResponse( + resourceGroupName, + sqlAvailabilityGroupDatabaseName, + sqlAvailabilityGroupName, + sqlAvailabilityGroupDatabaseUpdate, + Context.NONE) + .getValue(); + } + + /** + * List the Availability Group Databases associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Databases along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String sqlAvailabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the Availability Group Databases associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Databases along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String sqlAvailabilityGroupName, 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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName 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, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the Availability Group Databases associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String sqlAvailabilityGroupName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, sqlAvailabilityGroupName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the Availability Group Databases associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String sqlAvailabilityGroupName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, sqlAvailabilityGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the Availability Group Databases associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String sqlAvailabilityGroupName) { + return new PagedIterable<>(listAsync(resourceGroupName, sqlAvailabilityGroupName)); + } + + /** + * List the Availability Group Databases associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String sqlAvailabilityGroupName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, sqlAvailabilityGroupName, 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 Availability Group Databases 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 Availability Group Databases 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/SqlAvailabilityGroupDatabasesImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupDatabasesImpl.java new file mode 100644 index 000000000000..0be529b1f636 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupDatabasesImpl.java @@ -0,0 +1,226 @@ +// Copyright (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.SqlAvailabilityGroupDatabasesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlAvailabilityGroupDatabaseResourceInner; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseResource; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabases; + +public final class SqlAvailabilityGroupDatabasesImpl implements SqlAvailabilityGroupDatabases { + private static final ClientLogger LOGGER = new ClientLogger(SqlAvailabilityGroupDatabasesImpl.class); + + private final SqlAvailabilityGroupDatabasesClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public SqlAvailabilityGroupDatabasesImpl( + SqlAvailabilityGroupDatabasesClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response deleteWithResponse( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName, context); + } + + public void delete( + String resourceGroupName, String sqlAvailabilityGroupDatabaseName, String sqlAvailabilityGroupName) { + this.serviceClient().delete(resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName); + } + + public Response getWithResponse( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlAvailabilityGroupDatabaseResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlAvailabilityGroupDatabaseResource get( + String resourceGroupName, String sqlAvailabilityGroupDatabaseName, String sqlAvailabilityGroupName) { + SqlAvailabilityGroupDatabaseResourceInner inner = + this.serviceClient().get(resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName); + if (inner != null) { + return new SqlAvailabilityGroupDatabaseResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list( + String resourceGroupName, String sqlAvailabilityGroupName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, sqlAvailabilityGroupName); + return Utils.mapPage(inner, inner1 -> new SqlAvailabilityGroupDatabaseResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String sqlAvailabilityGroupName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, sqlAvailabilityGroupName, context); + return Utils.mapPage(inner, inner1 -> new SqlAvailabilityGroupDatabaseResourceImpl(inner1, this.manager())); + } + + public SqlAvailabilityGroupDatabaseResource 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 sqlAvailabilityGroupDatabaseName = Utils.getValueFromIdByName(id, "databases"); + if (sqlAvailabilityGroupDatabaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String sqlAvailabilityGroupName = Utils.getValueFromIdByName(id, "sqlAvailabilityGroups"); + if (sqlAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlAvailabilityGroups'.", + id))); + } + return this + .getWithResponse( + resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName, 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 sqlAvailabilityGroupDatabaseName = Utils.getValueFromIdByName(id, "databases"); + if (sqlAvailabilityGroupDatabaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String sqlAvailabilityGroupName = Utils.getValueFromIdByName(id, "sqlAvailabilityGroups"); + if (sqlAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlAvailabilityGroups'.", + id))); + } + return this + .getWithResponse(resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName, 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 sqlAvailabilityGroupDatabaseName = Utils.getValueFromIdByName(id, "databases"); + if (sqlAvailabilityGroupDatabaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String sqlAvailabilityGroupName = Utils.getValueFromIdByName(id, "sqlAvailabilityGroups"); + if (sqlAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlAvailabilityGroups'.", + id))); + } + this + .deleteWithResponse( + resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName, 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 sqlAvailabilityGroupDatabaseName = Utils.getValueFromIdByName(id, "databases"); + if (sqlAvailabilityGroupDatabaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String sqlAvailabilityGroupName = Utils.getValueFromIdByName(id, "sqlAvailabilityGroups"); + if (sqlAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlAvailabilityGroups'.", + id))); + } + return this + .deleteWithResponse(resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName, context); + } + + private SqlAvailabilityGroupDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public SqlAvailabilityGroupDatabaseResourceImpl define(String name) { + return new SqlAvailabilityGroupDatabaseResourceImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupImpl.java new file mode 100644 index 000000000000..391bea59d9a4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupImpl.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.SqlAvailabilityGroupInner; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroup; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupUpdate; +import java.util.Collections; +import java.util.Map; + +public final class SqlAvailabilityGroupImpl + implements SqlAvailabilityGroup, SqlAvailabilityGroup.Definition, SqlAvailabilityGroup.Update { + private SqlAvailabilityGroupInner 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 SqlAvailabilityGroupProperties 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 SqlAvailabilityGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sqlAvailabilityGroupName; + + private SqlAvailabilityGroupUpdate updateParameters; + + public SqlAvailabilityGroupImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public SqlAvailabilityGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroups() + .create(resourceGroupName, sqlAvailabilityGroupName, this.innerModel(), Context.NONE); + return this; + } + + public SqlAvailabilityGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroups() + .create(resourceGroupName, sqlAvailabilityGroupName, this.innerModel(), context); + return this; + } + + SqlAvailabilityGroupImpl(String name, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new SqlAvailabilityGroupInner(); + this.serviceManager = serviceManager; + this.sqlAvailabilityGroupName = name; + } + + public SqlAvailabilityGroupImpl update() { + this.updateParameters = new SqlAvailabilityGroupUpdate(); + return this; + } + + public SqlAvailabilityGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroups() + .updateWithResponse(resourceGroupName, sqlAvailabilityGroupName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public SqlAvailabilityGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroups() + .updateWithResponse(resourceGroupName, sqlAvailabilityGroupName, updateParameters, context) + .getValue(); + return this; + } + + SqlAvailabilityGroupImpl( + SqlAvailabilityGroupInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.sqlAvailabilityGroupName = Utils.getValueFromIdByName(innerObject.id(), "sqlAvailabilityGroups"); + } + + public SqlAvailabilityGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroups() + .getByResourceGroupWithResponse(resourceGroupName, sqlAvailabilityGroupName, Context.NONE) + .getValue(); + return this; + } + + public SqlAvailabilityGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroups() + .getByResourceGroupWithResponse(resourceGroupName, sqlAvailabilityGroupName, context) + .getValue(); + return this; + } + + public SqlAvailabilityGroupImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SqlAvailabilityGroupImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SqlAvailabilityGroupImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public SqlAvailabilityGroupImpl withProperties(SqlAvailabilityGroupProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupReplicaResourceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupReplicaResourceImpl.java new file mode 100644 index 000000000000..20c6bd3fc11f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupReplicaResourceImpl.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.SqlAvailabilityGroupReplicaResourceInner; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResource; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaUpdate; +import java.util.Collections; +import java.util.Map; + +public final class SqlAvailabilityGroupReplicaResourceImpl + implements SqlAvailabilityGroupReplicaResource, + SqlAvailabilityGroupReplicaResource.Definition, + SqlAvailabilityGroupReplicaResource.Update { + private SqlAvailabilityGroupReplicaResourceInner 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 SqlAvailabilityGroupReplicaResourceProperties 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 SqlAvailabilityGroupReplicaResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sqlServerInstanceName; + + private String sqlAvailabilityGroupName; + + private SqlAvailabilityGroupReplicaUpdate updateSqlAvailabilityGroupReplicaUpdate; + + public SqlAvailabilityGroupReplicaResourceImpl withExistingSqlAvailabilityGroup( + String resourceGroupName, String sqlAvailabilityGroupName) { + this.resourceGroupName = resourceGroupName; + this.sqlAvailabilityGroupName = sqlAvailabilityGroupName; + return this; + } + + public SqlAvailabilityGroupReplicaResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroupReplicas() + .createWithResponse( + resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SqlAvailabilityGroupReplicaResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroupReplicas() + .createWithResponse( + resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, this.innerModel(), context) + .getValue(); + return this; + } + + SqlAvailabilityGroupReplicaResourceImpl( + String name, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new SqlAvailabilityGroupReplicaResourceInner(); + this.serviceManager = serviceManager; + this.sqlServerInstanceName = name; + } + + public SqlAvailabilityGroupReplicaResourceImpl update() { + this.updateSqlAvailabilityGroupReplicaUpdate = new SqlAvailabilityGroupReplicaUpdate(); + return this; + } + + public SqlAvailabilityGroupReplicaResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroupReplicas() + .updateWithResponse( + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + updateSqlAvailabilityGroupReplicaUpdate, + Context.NONE) + .getValue(); + return this; + } + + public SqlAvailabilityGroupReplicaResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroupReplicas() + .updateWithResponse( + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + updateSqlAvailabilityGroupReplicaUpdate, + context) + .getValue(); + return this; + } + + SqlAvailabilityGroupReplicaResourceImpl( + SqlAvailabilityGroupReplicaResourceInner 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.sqlAvailabilityGroupName = Utils.getValueFromIdByName(innerObject.id(), "sqlAvailabilityGroups"); + } + + public SqlAvailabilityGroupReplicaResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroupReplicas() + .getWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, Context.NONE) + .getValue(); + return this; + } + + public SqlAvailabilityGroupReplicaResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlAvailabilityGroupReplicas() + .getWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, context) + .getValue(); + return this; + } + + public SqlAvailabilityGroupReplicaResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SqlAvailabilityGroupReplicaResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SqlAvailabilityGroupReplicaResourceImpl withProperties( + SqlAvailabilityGroupReplicaResourceProperties properties) { + if (isInCreateMode()) { + this.innerModel().withProperties(properties); + return this; + } else { + this.updateSqlAvailabilityGroupReplicaUpdate.withProperties(properties); + return this; + } + } + + public SqlAvailabilityGroupReplicaResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateSqlAvailabilityGroupReplicaUpdate.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/SqlAvailabilityGroupReplicasClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupReplicasClientImpl.java new file mode 100644 index 000000000000..e61860eea5fb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupReplicasClientImpl.java @@ -0,0 +1,1175 @@ +// Copyright (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.SqlAvailabilityGroupReplicasClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlAvailabilityGroupReplicaResourceInner; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlAvailabilityGroupReplicaListResult; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SqlAvailabilityGroupReplicasClient. */ +public final class SqlAvailabilityGroupReplicasClientImpl implements SqlAvailabilityGroupReplicasClient { + /** The proxy service used to perform REST calls. */ + private final SqlAvailabilityGroupReplicasService service; + + /** The service client containing this operation class. */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of SqlAvailabilityGroupReplicasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlAvailabilityGroupReplicasClientImpl(AzureArcDataManagementClientImpl client) { + this.service = + RestProxy + .create( + SqlAvailabilityGroupReplicasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientSqlAvailabilityGroupReplicas to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureArcDataManageme") + public interface SqlAvailabilityGroupReplicasService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/sqlServerInstances/{sqlServerInstanceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlAvailabilityGroupReplicaResourceInner sqlAvailabilityGroupReplicaResource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/sqlServerInstances/{sqlServerInstanceName}") + @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("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/sqlServerInstances/{sqlServerInstanceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/sqlServerInstances/{sqlServerInstanceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlAvailabilityGroupReplicaUpdate sqlAvailabilityGroupReplicaUpdate, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/sqlServerInstances") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @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 Availability Group Replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupReplicaResource The request body for availability group replica resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupReplicaResourceInner sqlAvailabilityGroupReplicaResource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupReplicaResource == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlAvailabilityGroupReplicaResource is required and cannot be null.")); + } else { + sqlAvailabilityGroupReplicaResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + sqlAvailabilityGroupReplicaResource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces an Arc Sql Availability Group Replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupReplicaResource The request body for availability group replica resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupReplicaResourceInner sqlAvailabilityGroupReplicaResource, + 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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupReplicaResource == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlAvailabilityGroupReplicaResource is required and cannot be null.")); + } else { + sqlAvailabilityGroupReplicaResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + sqlAvailabilityGroupReplicaResource, + accept, + context); + } + + /** + * Creates or replaces an Arc Sql Availability Group Replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupReplicaResource The request body for availability group replica resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupReplicaResourceInner sqlAvailabilityGroupReplicaResource) { + return createWithResponseAsync( + resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, sqlAvailabilityGroupReplicaResource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or replaces an Arc Sql Availability Group Replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupReplicaResource The request body for availability group replica resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupReplicaResourceInner sqlAvailabilityGroupReplicaResource, + Context context) { + return createWithResponseAsync( + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + sqlAvailabilityGroupReplicaResource, + context) + .block(); + } + + /** + * Creates or replaces an Arc Sql Availability Group Replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupReplicaResource The request body for availability group replica resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlAvailabilityGroupReplicaResourceInner create( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupReplicaResourceInner sqlAvailabilityGroupReplicaResource) { + return createWithResponse( + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + sqlAvailabilityGroupReplicaResource, + Context.NONE) + .getValue(); + } + + /** + * Deletes an Arc Sql availability group replica resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName 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, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an Arc Sql availability group replica resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, 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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName 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, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an Arc Sql availability group replica resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName) { + return deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes an Arc Sql availability group replica resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, Context context) { + return deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, context) + .block(); + } + + /** + * Deletes an Arc Sql availability group replica resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName) { + deleteWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, Context.NONE); + } + + /** + * Retrieves an Arc Sql availability group replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName 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, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves an Arc Sql availability group replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, 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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName 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, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Retrieves an Arc Sql availability group replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName) { + return getWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves an Arc Sql availability group replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, context) + .block(); + } + + /** + * Retrieves an Arc Sql availability group replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlAvailabilityGroupReplicaResourceInner get( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName) { + return getWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, Context.NONE) + .getValue(); + } + + /** + * Updates an existing Availability Group Replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupReplicaUpdate The requested availability group replica resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupReplicaUpdate sqlAvailabilityGroupReplicaUpdate) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupReplicaUpdate == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlAvailabilityGroupReplicaUpdate is required and cannot be null.")); + } else { + sqlAvailabilityGroupReplicaUpdate.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + sqlAvailabilityGroupReplicaUpdate, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing Availability Group Replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupReplicaUpdate The requested availability group replica resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupReplicaUpdate sqlAvailabilityGroupReplicaUpdate, + 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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupReplicaUpdate == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlAvailabilityGroupReplicaUpdate is required and cannot be null.")); + } else { + sqlAvailabilityGroupReplicaUpdate.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + sqlAvailabilityGroupReplicaUpdate, + accept, + context); + } + + /** + * Updates an existing Availability Group Replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupReplicaUpdate The requested availability group replica resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupReplicaUpdate sqlAvailabilityGroupReplicaUpdate) { + return updateWithResponseAsync( + resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, sqlAvailabilityGroupReplicaUpdate) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates an existing Availability Group Replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupReplicaUpdate The requested availability group replica resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupReplicaUpdate sqlAvailabilityGroupReplicaUpdate, + Context context) { + return updateWithResponseAsync( + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + sqlAvailabilityGroupReplicaUpdate, + context) + .block(); + } + + /** + * Updates an existing Availability Group Replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroupReplicaUpdate The requested availability group replica resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlAvailabilityGroupReplicaResourceInner update( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupReplicaUpdate sqlAvailabilityGroupReplicaUpdate) { + return updateWithResponse( + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + sqlAvailabilityGroupReplicaUpdate, + Context.NONE) + .getValue(); + } + + /** + * List the Availability Group Replica associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Replica along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String sqlAvailabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the Availability Group Replica associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Replica along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String sqlAvailabilityGroupName, 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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName 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, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the Availability Group Replica associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Replica as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String sqlAvailabilityGroupName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, sqlAvailabilityGroupName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the Availability Group Replica associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Replica as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String sqlAvailabilityGroupName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, sqlAvailabilityGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the Availability Group Replica associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Replica as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String sqlAvailabilityGroupName) { + return new PagedIterable<>(listAsync(resourceGroupName, sqlAvailabilityGroupName)); + } + + /** + * List the Availability Group Replica associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Replica as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String sqlAvailabilityGroupName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, sqlAvailabilityGroupName, 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 Availability Group Replica 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 Availability Group Replica 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/SqlAvailabilityGroupReplicasImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupReplicasImpl.java new file mode 100644 index 000000000000..49c9eb820c55 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupReplicasImpl.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.SqlAvailabilityGroupReplicasClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlAvailabilityGroupReplicaResourceInner; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResource; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicas; + +public final class SqlAvailabilityGroupReplicasImpl implements SqlAvailabilityGroupReplicas { + private static final ClientLogger LOGGER = new ClientLogger(SqlAvailabilityGroupReplicasImpl.class); + + private final SqlAvailabilityGroupReplicasClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public SqlAvailabilityGroupReplicasImpl( + SqlAvailabilityGroupReplicasClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response deleteWithResponse( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, context); + } + + public void delete(String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName) { + this.serviceClient().delete(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName); + } + + public Response getWithResponse( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlAvailabilityGroupReplicaResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlAvailabilityGroupReplicaResource get( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName) { + SqlAvailabilityGroupReplicaResourceInner inner = + this.serviceClient().get(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName); + if (inner != null) { + return new SqlAvailabilityGroupReplicaResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list( + String resourceGroupName, String sqlAvailabilityGroupName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, sqlAvailabilityGroupName); + return Utils.mapPage(inner, inner1 -> new SqlAvailabilityGroupReplicaResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String sqlAvailabilityGroupName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, sqlAvailabilityGroupName, context); + return Utils.mapPage(inner, inner1 -> new SqlAvailabilityGroupReplicaResourceImpl(inner1, this.manager())); + } + + public SqlAvailabilityGroupReplicaResource 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 sqlAvailabilityGroupName = Utils.getValueFromIdByName(id, "sqlAvailabilityGroups"); + if (sqlAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlAvailabilityGroups'.", + id))); + } + return this + .getWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, 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 sqlAvailabilityGroupName = Utils.getValueFromIdByName(id, "sqlAvailabilityGroups"); + if (sqlAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlAvailabilityGroups'.", + id))); + } + return this.getWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, 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 sqlAvailabilityGroupName = Utils.getValueFromIdByName(id, "sqlAvailabilityGroups"); + if (sqlAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlAvailabilityGroups'.", + id))); + } + this.deleteWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, 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 sqlAvailabilityGroupName = Utils.getValueFromIdByName(id, "sqlAvailabilityGroups"); + if (sqlAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlAvailabilityGroups'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, context); + } + + private SqlAvailabilityGroupReplicasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public SqlAvailabilityGroupReplicaResourceImpl define(String name) { + return new SqlAvailabilityGroupReplicaResourceImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupsClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupsClientImpl.java new file mode 100644 index 000000000000..1fd7730e9551 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupsClientImpl.java @@ -0,0 +1,1486 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.SqlAvailabilityGroupsClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlAvailabilityGroupInner; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupListResult; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupUpdate; +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 SqlAvailabilityGroupsClient. */ +public final class SqlAvailabilityGroupsClientImpl implements SqlAvailabilityGroupsClient { + /** The proxy service used to perform REST calls. */ + private final SqlAvailabilityGroupsService service; + + /** The service client containing this operation class. */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of SqlAvailabilityGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlAvailabilityGroupsClientImpl(AzureArcDataManagementClientImpl client) { + this.service = + RestProxy + .create(SqlAvailabilityGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientSqlAvailabilityGroups to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureArcDataManageme") + public interface SqlAvailabilityGroupsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups") + @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/sqlAvailabilityGroups") + @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/sqlAvailabilityGroups/{sqlAvailabilityGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlAvailabilityGroupInner sqlAvailabilityGroup, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlAvailabilityGroupUpdate 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 sqlAvailabilityGroups 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 SqlAvailabilityGroup 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 sqlAvailabilityGroups 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 SqlAvailabilityGroup 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 sqlAvailabilityGroups 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 SqlAvailabilityGroup as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List sqlAvailabilityGroups 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 SqlAvailabilityGroup 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 sqlAvailabilityGroups 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 SqlAvailabilityGroup as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List sqlAvailabilityGroups 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 SqlAvailabilityGroup as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List sqlAvailabilityGroups resources in the resource group + * + *

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

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

Gets all sqlAvailabilityGroups in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlAvailabilityGroups in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List sqlAvailabilityGroups resources in the resource group + * + *

Gets all sqlAvailabilityGroups in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlAvailabilityGroups in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List sqlAvailabilityGroups resources in the resource group + * + *

Gets all sqlAvailabilityGroups in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlAvailabilityGroups in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List sqlAvailabilityGroups resources in the resource group + * + *

Gets all sqlAvailabilityGroups in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlAvailabilityGroups in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Retrieves a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String sqlAvailabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String sqlAvailabilityGroupName, 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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName 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, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Retrieves a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String sqlAvailabilityGroupName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, sqlAvailabilityGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String sqlAvailabilityGroupName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, sqlAvailabilityGroupName, context).block(); + } + + /** + * Retrieves a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlAvailabilityGroupInner getByResourceGroup(String resourceGroupName, String sqlAvailabilityGroupName) { + return getByResourceGroupWithResponse(resourceGroupName, sqlAvailabilityGroupName, Context.NONE).getValue(); + } + + /** + * Creates or replaces a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroup The SQL Availability Group to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String sqlAvailabilityGroupName, SqlAvailabilityGroupInner sqlAvailabilityGroup) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroup == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlAvailabilityGroup is required and cannot be null.")); + } else { + sqlAvailabilityGroup.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + sqlAvailabilityGroup, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroup The SQL Availability Group to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupInner sqlAvailabilityGroup, + 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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroup == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlAvailabilityGroup is required and cannot be null.")); + } else { + sqlAvailabilityGroup.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + sqlAvailabilityGroup, + accept, + context); + } + + /** + * Creates or replaces a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroup The SQL Availability Group to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a SqlAvailabilityGroup. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlAvailabilityGroupInner> beginCreateAsync( + String resourceGroupName, String sqlAvailabilityGroupName, SqlAvailabilityGroupInner sqlAvailabilityGroup) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, sqlAvailabilityGroupName, sqlAvailabilityGroup); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlAvailabilityGroupInner.class, + SqlAvailabilityGroupInner.class, + this.client.getContext()); + } + + /** + * Creates or replaces a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroup The SQL Availability Group to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a SqlAvailabilityGroup. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlAvailabilityGroupInner> beginCreateAsync( + String resourceGroupName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupInner sqlAvailabilityGroup, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, sqlAvailabilityGroupName, sqlAvailabilityGroup, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlAvailabilityGroupInner.class, + SqlAvailabilityGroupInner.class, + context); + } + + /** + * Creates or replaces a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroup The SQL Availability Group to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a SqlAvailabilityGroup. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlAvailabilityGroupInner> beginCreate( + String resourceGroupName, String sqlAvailabilityGroupName, SqlAvailabilityGroupInner sqlAvailabilityGroup) { + return this.beginCreateAsync(resourceGroupName, sqlAvailabilityGroupName, sqlAvailabilityGroup).getSyncPoller(); + } + + /** + * Creates or replaces a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroup The SQL Availability Group to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a SqlAvailabilityGroup. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlAvailabilityGroupInner> beginCreate( + String resourceGroupName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupInner sqlAvailabilityGroup, + Context context) { + return this + .beginCreateAsync(resourceGroupName, sqlAvailabilityGroupName, sqlAvailabilityGroup, context) + .getSyncPoller(); + } + + /** + * Creates or replaces a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroup The SQL Availability Group to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String sqlAvailabilityGroupName, SqlAvailabilityGroupInner sqlAvailabilityGroup) { + return beginCreateAsync(resourceGroupName, sqlAvailabilityGroupName, sqlAvailabilityGroup) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or replaces a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroup The SQL Availability Group to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupInner sqlAvailabilityGroup, + Context context) { + return beginCreateAsync(resourceGroupName, sqlAvailabilityGroupName, sqlAvailabilityGroup, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or replaces a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroup The SQL Availability Group to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlAvailabilityGroupInner create( + String resourceGroupName, String sqlAvailabilityGroupName, SqlAvailabilityGroupInner sqlAvailabilityGroup) { + return createAsync(resourceGroupName, sqlAvailabilityGroupName, sqlAvailabilityGroup).block(); + } + + /** + * Creates or replaces a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlAvailabilityGroup The SQL Availability Group to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlAvailabilityGroupInner create( + String resourceGroupName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupInner sqlAvailabilityGroup, + Context context) { + return createAsync(resourceGroupName, sqlAvailabilityGroupName, sqlAvailabilityGroup, context).block(); + } + + /** + * Deletes a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String sqlAvailabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String sqlAvailabilityGroupName, 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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName 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, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String sqlAvailabilityGroupName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, sqlAvailabilityGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String sqlAvailabilityGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, sqlAvailabilityGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlAvailabilityGroupName) { + return this.beginDeleteAsync(resourceGroupName, sqlAvailabilityGroupName).getSyncPoller(); + } + + /** + * Deletes a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String sqlAvailabilityGroupName, Context context) { + return this.beginDeleteAsync(resourceGroupName, sqlAvailabilityGroupName, context).getSyncPoller(); + } + + /** + * Deletes a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String sqlAvailabilityGroupName) { + return beginDeleteAsync(resourceGroupName, sqlAvailabilityGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String sqlAvailabilityGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, sqlAvailabilityGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlAvailabilityGroupName) { + deleteAsync(resourceGroupName, sqlAvailabilityGroupName).block(); + } + + /** + * Deletes a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlAvailabilityGroupName, Context context) { + deleteAsync(resourceGroupName, sqlAvailabilityGroupName, context).block(); + } + + /** + * Updates a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param parameters The SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String sqlAvailabilityGroupName, SqlAvailabilityGroupUpdate 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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName 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, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param parameters The SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupUpdate 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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName 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, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Updates a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param parameters The SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String sqlAvailabilityGroupName, SqlAvailabilityGroupUpdate parameters) { + return updateWithResponseAsync(resourceGroupName, sqlAvailabilityGroupName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param parameters The SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String sqlAvailabilityGroupName, + SqlAvailabilityGroupUpdate parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, sqlAvailabilityGroupName, parameters, context).block(); + } + + /** + * Updates a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param parameters The SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlAvailabilityGroupInner update( + String resourceGroupName, String sqlAvailabilityGroupName, SqlAvailabilityGroupUpdate parameters) { + return updateWithResponse(resourceGroupName, sqlAvailabilityGroupName, 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 SqlAvailabilityGroup 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 SqlAvailabilityGroup 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 SqlAvailabilityGroup 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 SqlAvailabilityGroup 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/SqlAvailabilityGroupsImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupsImpl.java new file mode 100644 index 000000000000..68b4ac3f16e7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlAvailabilityGroupsImpl.java @@ -0,0 +1,186 @@ +// Copyright (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.SqlAvailabilityGroupsClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlAvailabilityGroupInner; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroup; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroups; + +public final class SqlAvailabilityGroupsImpl implements SqlAvailabilityGroups { + private static final ClientLogger LOGGER = new ClientLogger(SqlAvailabilityGroupsImpl.class); + + private final SqlAvailabilityGroupsClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public SqlAvailabilityGroupsImpl( + SqlAvailabilityGroupsClient 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 SqlAvailabilityGroupImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new SqlAvailabilityGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new SqlAvailabilityGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new SqlAvailabilityGroupImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String sqlAvailabilityGroupName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, sqlAvailabilityGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlAvailabilityGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlAvailabilityGroup getByResourceGroup(String resourceGroupName, String sqlAvailabilityGroupName) { + SqlAvailabilityGroupInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, sqlAvailabilityGroupName); + if (inner != null) { + return new SqlAvailabilityGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String sqlAvailabilityGroupName) { + this.serviceClient().delete(resourceGroupName, sqlAvailabilityGroupName); + } + + public void delete(String resourceGroupName, String sqlAvailabilityGroupName, Context context) { + this.serviceClient().delete(resourceGroupName, sqlAvailabilityGroupName, context); + } + + public SqlAvailabilityGroup 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 sqlAvailabilityGroupName = Utils.getValueFromIdByName(id, "sqlAvailabilityGroups"); + if (sqlAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlAvailabilityGroups'.", + id))); + } + return this + .getByResourceGroupWithResponse(resourceGroupName, sqlAvailabilityGroupName, 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 sqlAvailabilityGroupName = Utils.getValueFromIdByName(id, "sqlAvailabilityGroups"); + if (sqlAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlAvailabilityGroups'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, sqlAvailabilityGroupName, 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 sqlAvailabilityGroupName = Utils.getValueFromIdByName(id, "sqlAvailabilityGroups"); + if (sqlAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlAvailabilityGroups'.", + id))); + } + this.delete(resourceGroupName, sqlAvailabilityGroupName, 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 sqlAvailabilityGroupName = Utils.getValueFromIdByName(id, "sqlAvailabilityGroups"); + if (sqlAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlAvailabilityGroups'.", + id))); + } + this.delete(resourceGroupName, sqlAvailabilityGroupName, context); + } + + private SqlAvailabilityGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public SqlAvailabilityGroupImpl define(String name) { + return new SqlAvailabilityGroupImpl(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/SqlServerAvailabilityGroupResourceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupResourceImpl.java new file mode 100644 index 000000000000..12867d565fde --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupResourceImpl.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.SqlServerAvailabilityGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupUpdate; +import java.util.Collections; +import java.util.Map; + +public final class SqlServerAvailabilityGroupResourceImpl + implements SqlServerAvailabilityGroupResource, + SqlServerAvailabilityGroupResource.Definition, + SqlServerAvailabilityGroupResource.Update { + private SqlServerAvailabilityGroupResourceInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SqlServerAvailabilityGroupResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SqlServerAvailabilityGroupResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sqlServerInstanceName; + + private String sqlAvailabilityGroupName; + + private SqlServerAvailabilityGroupUpdate updateSqlServerAvailabilityGroupUpdate; + + public SqlServerAvailabilityGroupResourceImpl withExistingSqlServerInstance( + String resourceGroupName, String sqlServerInstanceName) { + this.resourceGroupName = resourceGroupName; + this.sqlServerInstanceName = sqlServerInstanceName; + return this; + } + + public SqlServerAvailabilityGroupResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServerAvailabilityGroups() + .createWithResponse( + resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SqlServerAvailabilityGroupResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServerAvailabilityGroups() + .createWithResponse( + resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, this.innerModel(), context) + .getValue(); + return this; + } + + SqlServerAvailabilityGroupResourceImpl( + String name, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new SqlServerAvailabilityGroupResourceInner(); + this.serviceManager = serviceManager; + this.sqlAvailabilityGroupName = name; + } + + public SqlServerAvailabilityGroupResourceImpl update() { + this.updateSqlServerAvailabilityGroupUpdate = new SqlServerAvailabilityGroupUpdate(); + return this; + } + + public SqlServerAvailabilityGroupResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServerAvailabilityGroups() + .updateWithResponse( + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + updateSqlServerAvailabilityGroupUpdate, + Context.NONE) + .getValue(); + return this; + } + + public SqlServerAvailabilityGroupResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServerAvailabilityGroups() + .updateWithResponse( + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + updateSqlServerAvailabilityGroupUpdate, + context) + .getValue(); + return this; + } + + SqlServerAvailabilityGroupResourceImpl( + SqlServerAvailabilityGroupResourceInner 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.sqlAvailabilityGroupName = Utils.getValueFromIdByName(innerObject.id(), "sqlAvailabilityGroups"); + } + + public SqlServerAvailabilityGroupResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServerAvailabilityGroups() + .getWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, Context.NONE) + .getValue(); + return this; + } + + public SqlServerAvailabilityGroupResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlServerAvailabilityGroups() + .getWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, context) + .getValue(); + return this; + } + + public SqlServerAvailabilityGroupResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SqlServerAvailabilityGroupResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SqlServerAvailabilityGroupResourceImpl withProperties( + SqlServerAvailabilityGroupResourceProperties properties) { + if (isInCreateMode()) { + this.innerModel().withProperties(properties); + return this; + } else { + this.updateSqlServerAvailabilityGroupUpdate.withProperties(properties); + return this; + } + } + + public SqlServerAvailabilityGroupResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateSqlServerAvailabilityGroupUpdate.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsClientImpl.java new file mode 100644 index 000000000000..ad51cfce3426 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsClientImpl.java @@ -0,0 +1,1173 @@ +// Copyright (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.SqlServerAvailabilityGroupsClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityGroupListResult; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SqlServerAvailabilityGroupsClient. */ +public final class SqlServerAvailabilityGroupsClientImpl implements SqlServerAvailabilityGroupsClient { + /** The proxy service used to perform REST calls. */ + private final SqlServerAvailabilityGroupsService service; + + /** The service client containing this operation class. */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of SqlServerAvailabilityGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlServerAvailabilityGroupsClientImpl(AzureArcDataManagementClientImpl client) { + this.service = + RestProxy + .create( + SqlServerAvailabilityGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientSqlServerAvailabilityGroups to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureArcDataManageme") + public interface SqlServerAvailabilityGroupsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/sqlAvailabilityGroups/{sqlAvailabilityGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/sqlAvailabilityGroups/{sqlAvailabilityGroupName}") + @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("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @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}/sqlAvailabilityGroups/{sqlAvailabilityGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @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}/sqlAvailabilityGroups/{sqlAvailabilityGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("sqlAvailabilityGroupName") String sqlAvailabilityGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/sqlAvailabilityGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + if (sqlServerAvailabilityGroupResource == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerAvailabilityGroupResource is required and cannot be null.")); + } else { + sqlServerAvailabilityGroupResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + sqlServerAvailabilityGroupResource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + if (sqlServerAvailabilityGroupResource == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerAvailabilityGroupResource is required and cannot be null.")); + } else { + sqlServerAvailabilityGroupResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + sqlServerAvailabilityGroupResource, + accept, + context); + } + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource) { + return createWithResponseAsync( + resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, sqlServerAvailabilityGroupResource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource, + Context context) { + return createWithResponseAsync( + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + sqlServerAvailabilityGroupResource, + context) + .block(); + } + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner create( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource) { + return createWithResponse( + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + sqlServerAvailabilityGroupResource, + Context.NONE) + .getValue(); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName 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, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, 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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName 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, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName) { + return deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, Context context) { + return deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, context) + .block(); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName) { + deleteWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, Context.NONE); + } + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName 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, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, 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 (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName 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, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName) { + return getWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, context) + .block(); + } + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner get( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName) { + return getWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, Context.NONE) + .getValue(); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + if (sqlServerAvailabilityGroupUpdate == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerAvailabilityGroupUpdate is required and cannot be null.")); + } else { + sqlServerAvailabilityGroupUpdate.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + sqlServerAvailabilityGroupUpdate, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + if (sqlAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sqlAvailabilityGroupName is required and cannot be null.")); + } + if (sqlServerAvailabilityGroupUpdate == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sqlServerAvailabilityGroupUpdate is required and cannot be null.")); + } else { + sqlServerAvailabilityGroupUpdate.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + this.client.getApiVersion(), + sqlServerAvailabilityGroupUpdate, + accept, + context); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate) { + return updateWithResponseAsync( + resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, sqlServerAvailabilityGroupUpdate) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, + Context context) { + return updateWithResponseAsync( + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + sqlServerAvailabilityGroupUpdate, + context) + .block(); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner update( + String resourceGroupName, + String sqlServerInstanceName, + String sqlAvailabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate) { + return updateWithResponse( + resourceGroupName, + sqlServerInstanceName, + sqlAvailabilityGroupName, + sqlServerAvailabilityGroupUpdate, + Context.NONE) + .getValue(); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Group along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String sqlServerInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlServerInstanceName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Group along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String sqlServerInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlServerInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + sqlServerInstanceName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String sqlServerInstanceName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, sqlServerInstanceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String sqlServerInstanceName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, sqlServerInstanceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String sqlServerInstanceName) { + return new PagedIterable<>(listAsync(resourceGroupName, sqlServerInstanceName)); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Group 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 Availability Group 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 Availability Group along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsImpl.java new file mode 100644 index 000000000000..31bad498b39f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsImpl.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroups; + +public final class SqlServerAvailabilityGroupsImpl implements SqlServerAvailabilityGroups { + private static final ClientLogger LOGGER = new ClientLogger(SqlServerAvailabilityGroupsImpl.class); + + private final SqlServerAvailabilityGroupsClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public SqlServerAvailabilityGroupsImpl( + SqlServerAvailabilityGroupsClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response deleteWithResponse( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, context); + } + + public void delete(String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName) { + this.serviceClient().delete(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName); + } + + public Response getWithResponse( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlServerAvailabilityGroupResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource get( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName) { + SqlServerAvailabilityGroupResourceInner inner = + this.serviceClient().get(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list( + String resourceGroupName, String sqlServerInstanceName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, sqlServerInstanceName); + return Utils.mapPage(inner, inner1 -> new SqlServerAvailabilityGroupResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String sqlServerInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, sqlServerInstanceName, context); + return Utils.mapPage(inner, inner1 -> new SqlServerAvailabilityGroupResourceImpl(inner1, this.manager())); + } + + public SqlServerAvailabilityGroupResource 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 sqlAvailabilityGroupName = Utils.getValueFromIdByName(id, "sqlAvailabilityGroups"); + if (sqlAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlAvailabilityGroups'.", + id))); + } + return this + .getWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, 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 sqlAvailabilityGroupName = Utils.getValueFromIdByName(id, "sqlAvailabilityGroups"); + if (sqlAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlAvailabilityGroups'.", + id))); + } + return this.getWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, 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 sqlAvailabilityGroupName = Utils.getValueFromIdByName(id, "sqlAvailabilityGroups"); + if (sqlAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlAvailabilityGroups'.", + id))); + } + this.deleteWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, 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 sqlAvailabilityGroupName = Utils.getValueFromIdByName(id, "sqlAvailabilityGroups"); + if (sqlAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlAvailabilityGroups'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, context); + } + + private SqlServerAvailabilityGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public SqlServerAvailabilityGroupResourceImpl define(String name) { + return new SqlServerAvailabilityGroupResourceImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabaseResourceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabaseResourceImpl.java new file mode 100644 index 000000000000..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/ArcSqlAvailabilityGroupDatabasesListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlAvailabilityGroupDatabasesListResult.java new file mode 100644 index 000000000000..665a58889fd0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlAvailabilityGroupDatabasesListResult.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.SqlAvailabilityGroupDatabaseResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Arc Sql Availability Group Databases. */ +@Immutable +public final class ArcSqlAvailabilityGroupDatabasesListResult { + /* + * Array of Arc Sql Availability Group 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 ArcSqlAvailabilityGroupDatabasesListResult class. */ + public ArcSqlAvailabilityGroupDatabasesListResult() { + } + + /** + * Get the value property: Array of Arc Sql Availability Group 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/ArcSqlAvailabilityGroupReplicaListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlAvailabilityGroupReplicaListResult.java new file mode 100644 index 000000000000..47a38cd38153 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlAvailabilityGroupReplicaListResult.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.SqlAvailabilityGroupReplicaResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Arc Sql Availability Group Replica. */ +@Immutable +public final class ArcSqlAvailabilityGroupReplicaListResult { + /* + * Array of Arc Sql Availability Group Replica. + */ + @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 ArcSqlAvailabilityGroupReplicaListResult class. */ + public ArcSqlAvailabilityGroupReplicaListResult() { + } + + /** + * Get the value property: Array of Arc Sql Availability Group Replica. + * + * @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/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/ArcSqlServerAvailabilityGroupListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityGroupListResult.java new file mode 100644 index 000000000000..ad0882019448 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityGroupListResult.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.SqlServerAvailabilityGroupResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Arc Sql Server Availability Group. */ +@Immutable +public final class ArcSqlServerAvailabilityGroupListResult { + /* + * Array of Arc Sql Server Availability Group. + */ + @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 ArcSqlServerAvailabilityGroupListResult class. */ + public ArcSqlServerAvailabilityGroupListResult() { + } + + /** + * Get the value property: Array of Arc Sql Server Availability Group. + * + * @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/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/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/SqlAvailabilityGroup.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroup.java new file mode 100644 index 000000000000..008000a11837 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroup.java @@ -0,0 +1,224 @@ +// Copyright (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.SqlAvailabilityGroupInner; +import java.util.Map; + +/** An immutable client-side representation of SqlAvailabilityGroup. */ +public interface SqlAvailabilityGroup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: null. + * + * @return the properties value. + */ + SqlAvailabilityGroupProperties 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.SqlAvailabilityGroupInner object. + * + * @return the inner object. + */ + SqlAvailabilityGroupInner innerModel(); + + /** The entirety of the SqlAvailabilityGroup definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The SqlAvailabilityGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the SqlAvailabilityGroup definition. */ + interface Blank extends WithLocation { + } + /** The stage of the SqlAvailabilityGroup 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 SqlAvailabilityGroup definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the Azure resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the SqlAvailabilityGroup 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.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlAvailabilityGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlAvailabilityGroup create(Context context); + } + /** The stage of the SqlAvailabilityGroup 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 SqlAvailabilityGroup definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: null. + * + * @param properties null. + * @return the next definition stage. + */ + WithCreate withProperties(SqlAvailabilityGroupProperties properties); + } + } + /** + * Begins update for the SqlAvailabilityGroup resource. + * + * @return the stage of resource update. + */ + SqlAvailabilityGroup.Update update(); + + /** The template for SqlAvailabilityGroup update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlAvailabilityGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlAvailabilityGroup apply(Context context); + } + /** The SqlAvailabilityGroup update stages. */ + interface UpdateStages { + /** The stage of the SqlAvailabilityGroup update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlAvailabilityGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlAvailabilityGroup refresh(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseReplicaResourceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseReplicaResourceProperties.java new file mode 100644 index 000000000000..4539e3f95f49 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseReplicaResourceProperties.java @@ -0,0 +1,276 @@ +// Copyright (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 properties of Arc Sql availability group database replica resource. */ +@Fluent +public final class SqlAvailabilityGroupDatabaseReplicaResourceProperties { + /* + * the database replica name. + */ + @JsonProperty(value = "replicaName") + private String replicaName; + + /* + * Whether the availability database is local. + */ + @JsonProperty(value = "isLocal") + private Boolean isLocal; + + /* + * Returns 1 if the replica is primary, or 0 if it is a secondary replica. + */ + @JsonProperty(value = "isPrimaryReplica") + private Boolean isPrimaryReplica; + + /* + * Description of the data-movement state. + */ + @JsonProperty(value = "synchronizationStateDesc") + private String synchronizationStateDesc; + + /* + * Whether this replica is transaction committer. + */ + @JsonProperty(value = "isCommitParticipant") + private Boolean isCommitParticipant; + + /* + * Description of the health of database. + */ + @JsonProperty(value = "synchronizationHealthDesc") + private String synchronizationHealthDesc; + + /* + * Description of the database state of the availability replica. + */ + @JsonProperty(value = "databaseStateDesc") + private String databaseStateDesc; + + /* + * Whether this data movement is suspended. + */ + @JsonProperty(value = "isSuspended") + private Boolean isSuspended; + + /* + * Description of the database suspended state reason. + */ + @JsonProperty(value = "suspendReasonDesc") + private String suspendReasonDesc; + + /* + * The provisioning state of the Arc-enabled SQL Server availability group resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** Creates an instance of SqlAvailabilityGroupDatabaseReplicaResourceProperties class. */ + public SqlAvailabilityGroupDatabaseReplicaResourceProperties() { + } + + /** + * Get the replicaName property: the database replica name. + * + * @return the replicaName value. + */ + public String replicaName() { + return this.replicaName; + } + + /** + * Set the replicaName property: the database replica name. + * + * @param replicaName the replicaName value to set. + * @return the SqlAvailabilityGroupDatabaseReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupDatabaseReplicaResourceProperties withReplicaName(String replicaName) { + this.replicaName = replicaName; + return this; + } + + /** + * Get the isLocal property: Whether the availability database is local. + * + * @return the isLocal value. + */ + public Boolean isLocal() { + return this.isLocal; + } + + /** + * Set the isLocal property: Whether the availability database is local. + * + * @param isLocal the isLocal value to set. + * @return the SqlAvailabilityGroupDatabaseReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupDatabaseReplicaResourceProperties withIsLocal(Boolean isLocal) { + this.isLocal = isLocal; + return this; + } + + /** + * Get the isPrimaryReplica property: Returns 1 if the replica is primary, or 0 if it is a secondary replica. + * + * @return the isPrimaryReplica value. + */ + public Boolean isPrimaryReplica() { + return this.isPrimaryReplica; + } + + /** + * Set the isPrimaryReplica property: Returns 1 if the replica is primary, or 0 if it is a secondary replica. + * + * @param isPrimaryReplica the isPrimaryReplica value to set. + * @return the SqlAvailabilityGroupDatabaseReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupDatabaseReplicaResourceProperties withIsPrimaryReplica(Boolean isPrimaryReplica) { + this.isPrimaryReplica = isPrimaryReplica; + return this; + } + + /** + * Get the synchronizationStateDesc property: Description of the data-movement state. + * + * @return the synchronizationStateDesc value. + */ + public String synchronizationStateDesc() { + return this.synchronizationStateDesc; + } + + /** + * Set the synchronizationStateDesc property: Description of the data-movement state. + * + * @param synchronizationStateDesc the synchronizationStateDesc value to set. + * @return the SqlAvailabilityGroupDatabaseReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupDatabaseReplicaResourceProperties withSynchronizationStateDesc( + String synchronizationStateDesc) { + this.synchronizationStateDesc = synchronizationStateDesc; + return this; + } + + /** + * Get the isCommitParticipant property: Whether this replica is transaction committer. + * + * @return the isCommitParticipant value. + */ + public Boolean isCommitParticipant() { + return this.isCommitParticipant; + } + + /** + * Set the isCommitParticipant property: Whether this replica is transaction committer. + * + * @param isCommitParticipant the isCommitParticipant value to set. + * @return the SqlAvailabilityGroupDatabaseReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupDatabaseReplicaResourceProperties withIsCommitParticipant(Boolean isCommitParticipant) { + this.isCommitParticipant = isCommitParticipant; + return this; + } + + /** + * Get the synchronizationHealthDesc property: Description of the health of database. + * + * @return the synchronizationHealthDesc value. + */ + public String synchronizationHealthDesc() { + return this.synchronizationHealthDesc; + } + + /** + * Set the synchronizationHealthDesc property: Description of the health of database. + * + * @param synchronizationHealthDesc the synchronizationHealthDesc value to set. + * @return the SqlAvailabilityGroupDatabaseReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupDatabaseReplicaResourceProperties withSynchronizationHealthDesc( + String synchronizationHealthDesc) { + this.synchronizationHealthDesc = synchronizationHealthDesc; + return this; + } + + /** + * Get the databaseStateDesc property: Description of the database state of the availability replica. + * + * @return the databaseStateDesc value. + */ + public String databaseStateDesc() { + return this.databaseStateDesc; + } + + /** + * Set the databaseStateDesc property: Description of the database state of the availability replica. + * + * @param databaseStateDesc the databaseStateDesc value to set. + * @return the SqlAvailabilityGroupDatabaseReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupDatabaseReplicaResourceProperties withDatabaseStateDesc(String databaseStateDesc) { + this.databaseStateDesc = databaseStateDesc; + return this; + } + + /** + * Get the isSuspended property: Whether this data movement is suspended. + * + * @return the isSuspended value. + */ + public Boolean isSuspended() { + return this.isSuspended; + } + + /** + * Set the isSuspended property: Whether this data movement is suspended. + * + * @param isSuspended the isSuspended value to set. + * @return the SqlAvailabilityGroupDatabaseReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupDatabaseReplicaResourceProperties withIsSuspended(Boolean isSuspended) { + this.isSuspended = isSuspended; + return this; + } + + /** + * Get the suspendReasonDesc property: Description of the database suspended state reason. + * + * @return the suspendReasonDesc value. + */ + public String suspendReasonDesc() { + return this.suspendReasonDesc; + } + + /** + * Set the suspendReasonDesc property: Description of the database suspended state reason. + * + * @param suspendReasonDesc the suspendReasonDesc value to set. + * @return the SqlAvailabilityGroupDatabaseReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupDatabaseReplicaResourceProperties withSuspendReasonDesc(String suspendReasonDesc) { + this.suspendReasonDesc = suspendReasonDesc; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the Arc-enabled SQL Server availability group + * resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseResource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseResource.java new file mode 100644 index 000000000000..faa5737666e2 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseResource.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.SqlAvailabilityGroupDatabaseResourceInner; +import java.util.Map; + +/** An immutable client-side representation of SqlAvailabilityGroupDatabaseResource. */ +public interface SqlAvailabilityGroupDatabaseResource { + /** + * 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 Availability Group Multiple Database Replica. + * + * @return the properties value. + */ + SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties 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.SqlAvailabilityGroupDatabaseResourceInner + * object. + * + * @return the inner object. + */ + SqlAvailabilityGroupDatabaseResourceInner innerModel(); + + /** The entirety of the SqlAvailabilityGroupDatabaseResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithProperties, + DefinitionStages.WithCreate { + } + /** The SqlAvailabilityGroupDatabaseResource definition stages. */ + interface DefinitionStages { + /** The first stage of the SqlAvailabilityGroupDatabaseResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the SqlAvailabilityGroupDatabaseResource 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 SqlAvailabilityGroupDatabaseResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, sqlAvailabilityGroupName. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @return the next definition stage. + */ + WithProperties withExistingSqlAvailabilityGroup(String resourceGroupName, String sqlAvailabilityGroupName); + } + /** The stage of the SqlAvailabilityGroupDatabaseResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of Arc Sql Availability Group Multiple Database Replica. + * + * @param properties Properties of Arc Sql Availability Group Multiple Database Replica. + * @return the next definition stage. + */ + WithCreate withProperties(SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties properties); + } + /** + * The stage of the SqlAvailabilityGroupDatabaseResource 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. + */ + SqlAvailabilityGroupDatabaseResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlAvailabilityGroupDatabaseResource create(Context context); + } + /** The stage of the SqlAvailabilityGroupDatabaseResource 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 SqlAvailabilityGroupDatabaseResource resource. + * + * @return the stage of resource update. + */ + SqlAvailabilityGroupDatabaseResource.Update update(); + + /** The template for SqlAvailabilityGroupDatabaseResource update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlAvailabilityGroupDatabaseResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlAvailabilityGroupDatabaseResource apply(Context context); + } + /** The SqlAvailabilityGroupDatabaseResource update stages. */ + interface UpdateStages { + /** The stage of the SqlAvailabilityGroupDatabaseResource 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 SqlAvailabilityGroupDatabaseResource update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The Availability Group Replica's properties. + * + * @param properties The Availability Group Replica's properties. + * @return the next definition stage. + */ + Update withProperties(SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlAvailabilityGroupDatabaseResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlAvailabilityGroupDatabaseResource refresh(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseUpdate.java new file mode 100644 index 000000000000..b3d3547f5ffb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseUpdate.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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 Availability Group Database Replica resource. */ +@Fluent +public final class SqlAvailabilityGroupDatabaseUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The Availability Group Replica's properties + */ + @JsonProperty(value = "properties") + private SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties properties; + + /** Creates an instance of SqlAvailabilityGroupDatabaseUpdate class. */ + public SqlAvailabilityGroupDatabaseUpdate() { + } + + /** + * 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 SqlAvailabilityGroupDatabaseUpdate object itself. + */ + public SqlAvailabilityGroupDatabaseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The Availability Group Replica's properties. + * + * @return the properties value. + */ + public SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The Availability Group Replica's properties. + * + * @param properties the properties value to set. + * @return the SqlAvailabilityGroupDatabaseUpdate object itself. + */ + public SqlAvailabilityGroupDatabaseUpdate withProperties( + SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties 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/SqlAvailabilityGroupDatabases.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabases.java new file mode 100644 index 000000000000..430fd737cced --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabases.java @@ -0,0 +1,153 @@ +// Copyright (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 SqlAvailabilityGroupDatabases. */ +public interface SqlAvailabilityGroupDatabases { + /** + * Deletes an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + Context context); + + /** + * Deletes an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String sqlAvailabilityGroupDatabaseName, String sqlAvailabilityGroupName); + + /** + * Retrieves an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group Database along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String sqlAvailabilityGroupDatabaseName, + String sqlAvailabilityGroupName, + Context context); + + /** + * Retrieves an Arc Sql availability group database resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupDatabaseName Name of SQL Availability Group Database. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group Database. + */ + SqlAvailabilityGroupDatabaseResource get( + String resourceGroupName, String sqlAvailabilityGroupDatabaseName, String sqlAvailabilityGroupName); + + /** + * List the Availability Group Databases associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Databases as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String sqlAvailabilityGroupName); + + /** + * List the Availability Group Databases associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Databases as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, String sqlAvailabilityGroupName, Context context); + + /** + * Retrieves an Arc Sql availability group 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. + * @return arc Sql Server Availability Group Database along with {@link Response}. + */ + SqlAvailabilityGroupDatabaseResource getById(String id); + + /** + * Retrieves an Arc Sql availability group 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 arc Sql Server Availability Group Database along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an Arc Sql availability group 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 availability group 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 SqlAvailabilityGroupDatabaseResource resource. + * + * @param name resource name. + * @return the first stage of the new SqlAvailabilityGroupDatabaseResource definition. + */ + SqlAvailabilityGroupDatabaseResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupListResult.java new file mode 100644 index 000000000000..fe1fc3b4f982 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupListResult.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.SqlAvailabilityGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of SqlAvailabilityGroup. */ +@Immutable +public final class SqlAvailabilityGroupListResult { + /* + * 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 SqlAvailabilityGroupListResult class. */ + public SqlAvailabilityGroupListResult() { + } + + /** + * 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/SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties.java new file mode 100644 index 000000000000..d1b8364398f7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties of Arc Sql availability group multiple database replica resource. */ +@Fluent +public final class SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties { + /* + * ID GUID of the database for availability group. + */ + @JsonProperty(value = "groupDatabaseId") + private String groupDatabaseId; + + /* + * Array of Arc Sql Availability Group Database Replicas. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The provisioning state of the Arc-enabled SQL Server availability group resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** Creates an instance of SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties class. */ + public SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties() { + } + + /** + * Get the groupDatabaseId property: ID GUID of the database for availability group. + * + * @return the groupDatabaseId value. + */ + public String groupDatabaseId() { + return this.groupDatabaseId; + } + + /** + * Set the groupDatabaseId property: ID GUID of the database for availability group. + * + * @param groupDatabaseId the groupDatabaseId value to set. + * @return the SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties withGroupDatabaseId(String groupDatabaseId) { + this.groupDatabaseId = groupDatabaseId; + return this; + } + + /** + * Get the value property: Array of Arc Sql Availability Group Database Replicas. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of Arc Sql Availability Group Database Replicas. + * + * @param value the value value to set. + * @return the SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties withValue( + List value) { + this.value = value; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the Arc-enabled SQL Server availability group + * resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupProperties.java new file mode 100644 index 000000000000..bbe209b8de0e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupProperties.java @@ -0,0 +1,355 @@ +// Copyright (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.time.OffsetDateTime; + +/** Properties of SqlAvailabilityGroup. */ +@Fluent +public final class SqlAvailabilityGroupProperties { + /* + * The name of the availability group. + */ + @JsonProperty(value = "availabilityGroupName", required = true) + private String availabilityGroupName; + + /* + * Id GUID of the availability group. + */ + @JsonProperty(value = "availabilityGroupId", required = true) + private String availabilityGroupId; + + /* + * The name of the instance name which availability group primary is on. + */ + @JsonProperty(value = "instanceName") + private String instanceName; + + /* + * Timestamp for when the data was collected from the client machine. + */ + @JsonProperty(value = "collectionTimestamp") + private OffsetDateTime collectionTimestamp; + + /* + * SQL Server availability group current version. + */ + @JsonProperty(value = "version") + private Integer version; + + /* + * SQL Server basic availability group. + */ + @JsonProperty(value = "basicFeatures") + private Boolean basicFeatures; + + /* + * SQL Server availability group DTC support enabled. + */ + @JsonProperty(value = "dtcSupport") + private Boolean dtcSupport; + + /* + * SQL Server availability group failover for database health conditions. + */ + @JsonProperty(value = "dbFailover") + private Boolean dbFailover; + + /* + * SQL Server distributed availability group. + */ + @JsonProperty(value = "isDistributed") + private Boolean isDistributed; + + /* + * SQL Server availability group cluster type description + */ + @JsonProperty(value = "clusterTypeDesc") + private String clusterTypeDesc; + + /* + * Availability group required the number of synchronized secondary to commit. + */ + @JsonProperty(value = "requiredSynchronizedSecondariesCommit") + private Integer requiredSynchronizedSecondariesCommit; + + /* + * SQL Server availability group contained system databases. + */ + @JsonProperty(value = "isContained") + private Boolean isContained; + + /** Creates an instance of SqlAvailabilityGroupProperties class. */ + public SqlAvailabilityGroupProperties() { + } + + /** + * Get the availabilityGroupName property: The name of the availability group. + * + * @return the availabilityGroupName value. + */ + public String availabilityGroupName() { + return this.availabilityGroupName; + } + + /** + * Set the availabilityGroupName property: The name of the availability group. + * + * @param availabilityGroupName the availabilityGroupName value to set. + * @return the SqlAvailabilityGroupProperties object itself. + */ + public SqlAvailabilityGroupProperties withAvailabilityGroupName(String availabilityGroupName) { + this.availabilityGroupName = availabilityGroupName; + return this; + } + + /** + * Get the availabilityGroupId property: Id GUID of the availability group. + * + * @return the availabilityGroupId value. + */ + public String availabilityGroupId() { + return this.availabilityGroupId; + } + + /** + * Set the availabilityGroupId property: Id GUID of the availability group. + * + * @param availabilityGroupId the availabilityGroupId value to set. + * @return the SqlAvailabilityGroupProperties object itself. + */ + public SqlAvailabilityGroupProperties withAvailabilityGroupId(String availabilityGroupId) { + this.availabilityGroupId = availabilityGroupId; + return this; + } + + /** + * Get the instanceName property: The name of the instance name which availability group primary is on. + * + * @return the instanceName value. + */ + public String instanceName() { + return this.instanceName; + } + + /** + * Set the instanceName property: The name of the instance name which availability group primary is on. + * + * @param instanceName the instanceName value to set. + * @return the SqlAvailabilityGroupProperties object itself. + */ + public SqlAvailabilityGroupProperties withInstanceName(String instanceName) { + this.instanceName = instanceName; + return this; + } + + /** + * Get the collectionTimestamp property: Timestamp for when the data was collected from the client machine. + * + * @return the collectionTimestamp value. + */ + public OffsetDateTime collectionTimestamp() { + return this.collectionTimestamp; + } + + /** + * Set the collectionTimestamp property: Timestamp for when the data was collected from the client machine. + * + * @param collectionTimestamp the collectionTimestamp value to set. + * @return the SqlAvailabilityGroupProperties object itself. + */ + public SqlAvailabilityGroupProperties withCollectionTimestamp(OffsetDateTime collectionTimestamp) { + this.collectionTimestamp = collectionTimestamp; + return this; + } + + /** + * Get the version property: SQL Server availability group current version. + * + * @return the version value. + */ + public Integer version() { + return this.version; + } + + /** + * Set the version property: SQL Server availability group current version. + * + * @param version the version value to set. + * @return the SqlAvailabilityGroupProperties object itself. + */ + public SqlAvailabilityGroupProperties withVersion(Integer version) { + this.version = version; + return this; + } + + /** + * Get the basicFeatures property: SQL Server basic availability group. + * + * @return the basicFeatures value. + */ + public Boolean basicFeatures() { + return this.basicFeatures; + } + + /** + * Set the basicFeatures property: SQL Server basic availability group. + * + * @param basicFeatures the basicFeatures value to set. + * @return the SqlAvailabilityGroupProperties object itself. + */ + public SqlAvailabilityGroupProperties withBasicFeatures(Boolean basicFeatures) { + this.basicFeatures = basicFeatures; + return this; + } + + /** + * Get the dtcSupport property: SQL Server availability group DTC support enabled. + * + * @return the dtcSupport value. + */ + public Boolean dtcSupport() { + return this.dtcSupport; + } + + /** + * Set the dtcSupport property: SQL Server availability group DTC support enabled. + * + * @param dtcSupport the dtcSupport value to set. + * @return the SqlAvailabilityGroupProperties object itself. + */ + public SqlAvailabilityGroupProperties withDtcSupport(Boolean dtcSupport) { + this.dtcSupport = dtcSupport; + return this; + } + + /** + * Get the dbFailover property: SQL Server availability group failover for database health conditions. + * + * @return the dbFailover value. + */ + public Boolean dbFailover() { + return this.dbFailover; + } + + /** + * Set the dbFailover property: SQL Server availability group failover for database health conditions. + * + * @param dbFailover the dbFailover value to set. + * @return the SqlAvailabilityGroupProperties object itself. + */ + public SqlAvailabilityGroupProperties withDbFailover(Boolean dbFailover) { + this.dbFailover = dbFailover; + return this; + } + + /** + * Get the isDistributed property: SQL Server distributed availability group. + * + * @return the isDistributed value. + */ + public Boolean isDistributed() { + return this.isDistributed; + } + + /** + * Set the isDistributed property: SQL Server distributed availability group. + * + * @param isDistributed the isDistributed value to set. + * @return the SqlAvailabilityGroupProperties object itself. + */ + public SqlAvailabilityGroupProperties withIsDistributed(Boolean isDistributed) { + this.isDistributed = isDistributed; + return this; + } + + /** + * Get the clusterTypeDesc property: SQL Server availability group cluster type description. + * + * @return the clusterTypeDesc value. + */ + public String clusterTypeDesc() { + return this.clusterTypeDesc; + } + + /** + * Set the clusterTypeDesc property: SQL Server availability group cluster type description. + * + * @param clusterTypeDesc the clusterTypeDesc value to set. + * @return the SqlAvailabilityGroupProperties object itself. + */ + public SqlAvailabilityGroupProperties withClusterTypeDesc(String clusterTypeDesc) { + this.clusterTypeDesc = clusterTypeDesc; + return this; + } + + /** + * Get the requiredSynchronizedSecondariesCommit property: Availability group required the number of synchronized + * secondary to commit. + * + * @return the requiredSynchronizedSecondariesCommit value. + */ + public Integer requiredSynchronizedSecondariesCommit() { + return this.requiredSynchronizedSecondariesCommit; + } + + /** + * Set the requiredSynchronizedSecondariesCommit property: Availability group required the number of synchronized + * secondary to commit. + * + * @param requiredSynchronizedSecondariesCommit the requiredSynchronizedSecondariesCommit value to set. + * @return the SqlAvailabilityGroupProperties object itself. + */ + public SqlAvailabilityGroupProperties withRequiredSynchronizedSecondariesCommit( + Integer requiredSynchronizedSecondariesCommit) { + this.requiredSynchronizedSecondariesCommit = requiredSynchronizedSecondariesCommit; + return this; + } + + /** + * Get the isContained property: SQL Server availability group contained system databases. + * + * @return the isContained value. + */ + public Boolean isContained() { + return this.isContained; + } + + /** + * Set the isContained property: SQL Server availability group contained system databases. + * + * @param isContained the isContained value to set. + * @return the SqlAvailabilityGroupProperties object itself. + */ + public SqlAvailabilityGroupProperties withIsContained(Boolean isContained) { + this.isContained = isContained; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (availabilityGroupName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property availabilityGroupName in model SqlAvailabilityGroupProperties")); + } + if (availabilityGroupId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property availabilityGroupId in model SqlAvailabilityGroupProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlAvailabilityGroupProperties.class); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaResource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaResource.java new file mode 100644 index 000000000000..3b079be38526 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaResource.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.SqlAvailabilityGroupReplicaResourceInner; +import java.util.Map; + +/** An immutable client-side representation of SqlAvailabilityGroupReplicaResource. */ +public interface SqlAvailabilityGroupReplicaResource { + /** + * 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 Availability Group Replica. + * + * @return the properties value. + */ + SqlAvailabilityGroupReplicaResourceProperties 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.SqlAvailabilityGroupReplicaResourceInner + * object. + * + * @return the inner object. + */ + SqlAvailabilityGroupReplicaResourceInner innerModel(); + + /** The entirety of the SqlAvailabilityGroupReplicaResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithProperties, + DefinitionStages.WithCreate { + } + /** The SqlAvailabilityGroupReplicaResource definition stages. */ + interface DefinitionStages { + /** The first stage of the SqlAvailabilityGroupReplicaResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the SqlAvailabilityGroupReplicaResource 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 SqlAvailabilityGroupReplicaResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, sqlAvailabilityGroupName. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @return the next definition stage. + */ + WithProperties withExistingSqlAvailabilityGroup(String resourceGroupName, String sqlAvailabilityGroupName); + } + /** The stage of the SqlAvailabilityGroupReplicaResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of Arc Sql Availability Group Replica. + * + * @param properties Properties of Arc Sql Availability Group Replica. + * @return the next definition stage. + */ + WithCreate withProperties(SqlAvailabilityGroupReplicaResourceProperties properties); + } + /** + * The stage of the SqlAvailabilityGroupReplicaResource 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. + */ + SqlAvailabilityGroupReplicaResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlAvailabilityGroupReplicaResource create(Context context); + } + /** The stage of the SqlAvailabilityGroupReplicaResource 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 SqlAvailabilityGroupReplicaResource resource. + * + * @return the stage of resource update. + */ + SqlAvailabilityGroupReplicaResource.Update update(); + + /** The template for SqlAvailabilityGroupReplicaResource update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlAvailabilityGroupReplicaResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlAvailabilityGroupReplicaResource apply(Context context); + } + /** The SqlAvailabilityGroupReplicaResource update stages. */ + interface UpdateStages { + /** The stage of the SqlAvailabilityGroupReplicaResource 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 SqlAvailabilityGroupReplicaResource update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The Availability Group Replica's properties. + * + * @param properties The Availability Group Replica's properties. + * @return the next definition stage. + */ + Update withProperties(SqlAvailabilityGroupReplicaResourceProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlAvailabilityGroupReplicaResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlAvailabilityGroupReplicaResource refresh(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaResourceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaResourceProperties.java new file mode 100644 index 000000000000..8dd371262463 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaResourceProperties.java @@ -0,0 +1,150 @@ +// Copyright (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 properties of Arc Sql availability group replica resource. */ +@Fluent +public final class SqlAvailabilityGroupReplicaResourceProperties { + /* + * ID GUID of the availability group. + */ + @JsonProperty(value = "replicaId") + private String replicaId; + + /* + * the replica name. + */ + @JsonProperty(value = "replicaName") + private String replicaName; + + /* + * null + */ + @JsonProperty(value = "configure") + private AvailabilityGroupConfigure configure; + + /* + * null + */ + @JsonProperty(value = "state") + private AvailabilityGroupState state; + + /* + * The provisioning state of the Arc-enabled SQL Server availability group resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** Creates an instance of SqlAvailabilityGroupReplicaResourceProperties class. */ + public SqlAvailabilityGroupReplicaResourceProperties() { + } + + /** + * Get the replicaId property: ID GUID of the availability group. + * + * @return the replicaId value. + */ + public String replicaId() { + return this.replicaId; + } + + /** + * Set the replicaId property: ID GUID of the availability group. + * + * @param replicaId the replicaId value to set. + * @return the SqlAvailabilityGroupReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupReplicaResourceProperties withReplicaId(String replicaId) { + this.replicaId = replicaId; + return this; + } + + /** + * Get the replicaName property: the replica name. + * + * @return the replicaName value. + */ + public String replicaName() { + return this.replicaName; + } + + /** + * Set the replicaName property: the replica name. + * + * @param replicaName the replicaName value to set. + * @return the SqlAvailabilityGroupReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupReplicaResourceProperties withReplicaName(String replicaName) { + this.replicaName = replicaName; + return this; + } + + /** + * Get the configure property: null. + * + * @return the configure value. + */ + public AvailabilityGroupConfigure configure() { + return this.configure; + } + + /** + * Set the configure property: null. + * + * @param configure the configure value to set. + * @return the SqlAvailabilityGroupReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupReplicaResourceProperties withConfigure(AvailabilityGroupConfigure configure) { + this.configure = configure; + return this; + } + + /** + * Get the state property: null. + * + * @return the state value. + */ + public AvailabilityGroupState state() { + return this.state; + } + + /** + * Set the state property: null. + * + * @param state the state value to set. + * @return the SqlAvailabilityGroupReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupReplicaResourceProperties withState(AvailabilityGroupState state) { + this.state = state; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the Arc-enabled SQL Server availability group + * resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (configure() != null) { + configure().validate(); + } + if (state() != null) { + state().validate(); + } + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaUpdate.java new file mode 100644 index 000000000000..914216b6ea14 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaUpdate.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 Availability Group Replica resource. */ +@Fluent +public final class SqlAvailabilityGroupReplicaUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The Availability Group Replica's properties + */ + @JsonProperty(value = "properties") + private SqlAvailabilityGroupReplicaResourceProperties properties; + + /** Creates an instance of SqlAvailabilityGroupReplicaUpdate class. */ + public SqlAvailabilityGroupReplicaUpdate() { + } + + /** + * 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 SqlAvailabilityGroupReplicaUpdate object itself. + */ + public SqlAvailabilityGroupReplicaUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The Availability Group Replica's properties. + * + * @return the properties value. + */ + public SqlAvailabilityGroupReplicaResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The Availability Group Replica's properties. + * + * @param properties the properties value to set. + * @return the SqlAvailabilityGroupReplicaUpdate object itself. + */ + public SqlAvailabilityGroupReplicaUpdate withProperties(SqlAvailabilityGroupReplicaResourceProperties 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/SqlAvailabilityGroupReplicas.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicas.java new file mode 100644 index 000000000000..6455755b9950 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicas.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SqlAvailabilityGroupReplicas. */ +public interface SqlAvailabilityGroupReplicas { + /** + * Deletes an Arc Sql availability group replica resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, Context context); + + /** + * Deletes an Arc Sql availability group replica resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName); + + /** + * Retrieves an Arc Sql availability group replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, Context context); + + /** + * Retrieves an Arc Sql availability group replica. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlAvailabilityGroupReplicaResource get( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName); + + /** + * List the Availability Group Replica associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Replica as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String sqlAvailabilityGroupName); + + /** + * List the Availability Group Replica associated with the given Arc Sql AG. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Availability Group Replica as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, String sqlAvailabilityGroupName, Context context); + + /** + * Retrieves an Arc Sql availability group replica. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + SqlAvailabilityGroupReplicaResource getById(String id); + + /** + * Retrieves an Arc Sql availability group replica. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an Arc Sql availability group replica 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 availability group replica 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 SqlAvailabilityGroupReplicaResource resource. + * + * @param name resource name. + * @return the first stage of the new SqlAvailabilityGroupReplicaResource definition. + */ + SqlAvailabilityGroupReplicaResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupUpdate.java new file mode 100644 index 000000000000..30c3c98c82ed --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupUpdate.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An update to a SQL Availability Group. */ +@Fluent +public final class SqlAvailabilityGroupUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of SqlAvailabilityGroupUpdate class. */ + public SqlAvailabilityGroupUpdate() { + } + + /** + * 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 SqlAvailabilityGroupUpdate object itself. + */ + public SqlAvailabilityGroupUpdate withTags(Map tags) { + this.tags = tags; + 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/SqlAvailabilityGroups.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroups.java new file mode 100644 index 000000000000..d54072313e40 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroups.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 SqlAvailabilityGroups. */ +public interface SqlAvailabilityGroups { + /** + * List sqlAvailabilityGroups 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 SqlAvailabilityGroup as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List sqlAvailabilityGroups 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 SqlAvailabilityGroup as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List sqlAvailabilityGroups resources in the resource group + * + *

Gets all sqlAvailabilityGroups in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlAvailabilityGroups in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List sqlAvailabilityGroups resources in the resource group + * + *

Gets all sqlAvailabilityGroups in a resource group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all sqlAvailabilityGroups in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieves a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String sqlAvailabilityGroupName, Context context); + + /** + * Retrieves a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup. + */ + SqlAvailabilityGroup getByResourceGroup(String resourceGroupName, String sqlAvailabilityGroupName); + + /** + * Deletes a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String sqlAvailabilityGroupName); + + /** + * Deletes a SQL Availability Group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String sqlAvailabilityGroupName, Context context); + + /** + * Retrieves a SQL Availability Group resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup along with {@link Response}. + */ + SqlAvailabilityGroup getById(String id); + + /** + * Retrieves a SQL Availability Group resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlAvailabilityGroup along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a SQL Availability Group resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a SQL Availability Group resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SqlAvailabilityGroup resource. + * + * @param name resource name. + * @return the first stage of the new SqlAvailabilityGroup definition. + */ + SqlAvailabilityGroup.DefinitionStages.Blank define(String name); +} 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/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/SqlServerAvailabilityGroupResource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResource.java new file mode 100644 index 000000000000..6623596198fe --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResource.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.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.SqlServerAvailabilityGroupResourceInner; +import java.util.Map; + +/** An immutable client-side representation of SqlServerAvailabilityGroupResource. */ +public interface SqlServerAvailabilityGroupResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: Properties of Arc Sql Server availability group. + * + * @return the properties value. + */ + SqlServerAvailabilityGroupResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner + * object. + * + * @return the inner object. + */ + SqlServerAvailabilityGroupResourceInner innerModel(); + + /** The entirety of the SqlServerAvailabilityGroupResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithProperties, + DefinitionStages.WithCreate { + } + /** The SqlServerAvailabilityGroupResource definition stages. */ + interface DefinitionStages { + /** The first stage of the SqlServerAvailabilityGroupResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the SqlServerAvailabilityGroupResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the SqlServerAvailabilityGroupResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, sqlServerInstanceName. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @return the next definition stage. + */ + WithProperties withExistingSqlServerInstance(String resourceGroupName, String sqlServerInstanceName); + } + /** The stage of the SqlServerAvailabilityGroupResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of Arc Sql Server availability group. + * + * @param properties Properties of Arc Sql Server availability group. + * @return the next definition stage. + */ + WithCreate withProperties(SqlServerAvailabilityGroupResourceProperties properties); + } + /** + * The stage of the SqlServerAvailabilityGroupResource definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlServerAvailabilityGroupResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlServerAvailabilityGroupResource create(Context context); + } + /** The stage of the SqlServerAvailabilityGroupResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + /** + * Begins update for the SqlServerAvailabilityGroupResource resource. + * + * @return the stage of resource update. + */ + SqlServerAvailabilityGroupResource.Update update(); + + /** The template for SqlServerAvailabilityGroupResource update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlServerAvailabilityGroupResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlServerAvailabilityGroupResource apply(Context context); + } + /** The SqlServerAvailabilityGroupResource update stages. */ + interface UpdateStages { + /** The stage of the SqlServerAvailabilityGroupResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the SqlServerAvailabilityGroupResource update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The Server Availability Group's properties. + * + * @param properties The Server Availability Group's properties. + * @return the next definition stage. + */ + Update withProperties(SqlServerAvailabilityGroupResourceProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlServerAvailabilityGroupResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlServerAvailabilityGroupResource refresh(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourceProperties.java new file mode 100644 index 000000000000..3f67fd39bb92 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourceProperties.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.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of Arc Sql Server availability group resource. */ +@Fluent +public final class SqlServerAvailabilityGroupResourceProperties { + /* + * ID GUID of the availability group. + */ + @JsonProperty(value = "availabilityGroupId", required = true) + private String availabilityGroupId; + + /* + * the availability group name. + */ + @JsonProperty(value = "availabilityGroupName") + private String availabilityGroupName; + + /* + * null + */ + @JsonProperty(value = "configure") + private AvailabilityGroupConfigure configure; + + /* + * null + */ + @JsonProperty(value = "state") + private AvailabilityGroupState state; + + /* + * The provisioning state of the Arc-enabled SQL Server availability group resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** Creates an instance of SqlServerAvailabilityGroupResourceProperties class. */ + public SqlServerAvailabilityGroupResourceProperties() { + } + + /** + * Get the availabilityGroupId property: ID GUID of the availability group. + * + * @return the availabilityGroupId value. + */ + public String availabilityGroupId() { + return this.availabilityGroupId; + } + + /** + * Set the availabilityGroupId property: ID GUID of the availability group. + * + * @param availabilityGroupId the availabilityGroupId value to set. + * @return the SqlServerAvailabilityGroupResourceProperties object itself. + */ + public SqlServerAvailabilityGroupResourceProperties withAvailabilityGroupId(String availabilityGroupId) { + this.availabilityGroupId = availabilityGroupId; + return this; + } + + /** + * Get the availabilityGroupName property: the availability group name. + * + * @return the availabilityGroupName value. + */ + public String availabilityGroupName() { + return this.availabilityGroupName; + } + + /** + * Set the availabilityGroupName property: the availability group name. + * + * @param availabilityGroupName the availabilityGroupName value to set. + * @return the SqlServerAvailabilityGroupResourceProperties object itself. + */ + public SqlServerAvailabilityGroupResourceProperties withAvailabilityGroupName(String availabilityGroupName) { + this.availabilityGroupName = availabilityGroupName; + return this; + } + + /** + * Get the configure property: null. + * + * @return the configure value. + */ + public AvailabilityGroupConfigure configure() { + return this.configure; + } + + /** + * Set the configure property: null. + * + * @param configure the configure value to set. + * @return the SqlServerAvailabilityGroupResourceProperties object itself. + */ + public SqlServerAvailabilityGroupResourceProperties withConfigure(AvailabilityGroupConfigure configure) { + this.configure = configure; + return this; + } + + /** + * Get the state property: null. + * + * @return the state value. + */ + public AvailabilityGroupState state() { + return this.state; + } + + /** + * Set the state property: null. + * + * @param state the state value to set. + * @return the SqlServerAvailabilityGroupResourceProperties object itself. + */ + public SqlServerAvailabilityGroupResourceProperties withState(AvailabilityGroupState state) { + this.state = state; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the Arc-enabled SQL Server availability group + * resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (availabilityGroupId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property availabilityGroupId in model" + + " SqlServerAvailabilityGroupResourceProperties")); + } + if (configure() != null) { + configure().validate(); + } + if (state() != null) { + state().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlServerAvailabilityGroupResourceProperties.class); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupUpdate.java new file mode 100644 index 000000000000..900642ede17f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupUpdate.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 availability group resource. */ +@Fluent +public final class SqlServerAvailabilityGroupUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The Server Availability Group's properties + */ + @JsonProperty(value = "properties") + private SqlServerAvailabilityGroupResourceProperties properties; + + /** Creates an instance of SqlServerAvailabilityGroupUpdate class. */ + public SqlServerAvailabilityGroupUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the SqlServerAvailabilityGroupUpdate object itself. + */ + public SqlServerAvailabilityGroupUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The Server Availability Group's properties. + * + * @return the properties value. + */ + public SqlServerAvailabilityGroupResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The Server Availability Group's properties. + * + * @param properties the properties value to set. + * @return the SqlServerAvailabilityGroupUpdate object itself. + */ + public SqlServerAvailabilityGroupUpdate withProperties(SqlServerAvailabilityGroupResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroups.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroups.java new file mode 100644 index 000000000000..0ba8c8806215 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroups.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SqlServerAvailabilityGroups. */ +public interface SqlServerAvailabilityGroups { + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, Context context); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName, Context context); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlAvailabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource get( + String resourceGroupName, String sqlServerInstanceName, String sqlAvailabilityGroupName); + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Group as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String sqlServerInstanceName); + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the Azure resource group. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Group as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, String sqlServerInstanceName, Context context); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + SqlServerAvailabilityGroupResource getById(String id); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SqlServerAvailabilityGroupResource resource. + * + * @param name resource name. + * @return the first stage of the new SqlServerAvailabilityGroupResource definition. + */ + SqlServerAvailabilityGroupResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResource.java new file mode 100644 index 000000000000..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..885e94b0b959 --- /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-03-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..f8a7a8df9a18 --- /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-03-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..9bfceb58d0f4 --- /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-03-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..b73816e4e6c7 --- /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-03-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..09f3d7981d88 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-03-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..2175c29151d0 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-03-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..8bc900d1c488 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-03-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..73e27b0d0a1b 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-03-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..2abb0f62c364 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-03-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..3473414450a9 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-03-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..da9dcad04f04 --- /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-03-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..465b124289d3 --- /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-03-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..2448ae2e42f9 --- /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-03-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..053b563f5df3 --- /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-03-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..0c6df3bb23b7 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-03-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..1ec3ff6ef6c1 --- /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-03-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..50bede61efd5 --- /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-03-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..39a9357c45c1 --- /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-03-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..f2b66f241106 --- /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-03-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..0ac632f9e975 --- /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-03-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..03e40596cdb5 --- /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-03-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/SqlAvailabilityGroupDatabasesCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesCreateSamples.java new file mode 100644 index 000000000000..6dbfd1acd4f7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesCreateSamples.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.generated; + +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlAvailabilityGroupDatabases Create. */ +public final class SqlAvailabilityGroupDatabasesCreateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/CreateOrUpdateArcSqlAvailabilityGroupDatabase.json + */ + /** + * Sample code: Create a Arc availability group database. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createAArcAvailabilityGroupDatabase( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlAvailabilityGroupDatabases() + .define("testSqlDatabase") + .withRegion("southeastasia") + .withExistingSqlAvailabilityGroup("testrg", "testAG") + .withProperties( + new SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties() + .withGroupDatabaseId("00000000-1111-2222-3333-444444444444") + .withValue( + Arrays + .asList( + new SqlAvailabilityGroupDatabaseReplicaResourceProperties() + .withReplicaName("sqlServer1") + .withIsLocal(true) + .withIsPrimaryReplica(true) + .withSynchronizationStateDesc("SYNCHRONIZED") + .withIsCommitParticipant(true) + .withSynchronizationHealthDesc("HEALTHY") + .withDatabaseStateDesc("ONLINE") + .withIsSuspended(false), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties() + .withReplicaName("sqlServer2") + .withIsLocal(false) + .withIsPrimaryReplica(false) + .withSynchronizationStateDesc("SYNCHRONIZED") + .withIsCommitParticipant(true) + .withSynchronizationHealthDesc("HEALTHY") + .withDatabaseStateDesc("ONLINE") + .withIsSuspended(false)))) + .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/SqlAvailabilityGroupDatabasesDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesDeleteSamples.java new file mode 100644 index 000000000000..5ecb9463c37c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesDeleteSamples.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 SqlAvailabilityGroupDatabases Delete. */ +public final class SqlAvailabilityGroupDatabasesDeleteSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/DeleteArcSqlAvailabilityGroupDatabase.json + */ + /** + * Sample code: Deletes an Arc Sql availability group database resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deletesAnArcSqlAvailabilityGroupDatabaseResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlAvailabilityGroupDatabases() + .deleteWithResponse("testrg", "testSqlDatabase", "testAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesGetSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesGetSamples.java new file mode 100644 index 000000000000..45a65630853e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesGetSamples.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 SqlAvailabilityGroupDatabases Get. */ +public final class SqlAvailabilityGroupDatabasesGetSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/GetArcSqlAvailabilityGroupDatabase.json + */ + /** + * Sample code: Retrieves an Arc Sql Server availability group database resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesAnArcSqlServerAvailabilityGroupDatabaseResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlAvailabilityGroupDatabases() + .getWithResponse("testrg", "testSqlDatabase", "testAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesListSamples.java new file mode 100644 index 000000000000..3d7d36bd26c3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesListSamples.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 SqlAvailabilityGroupDatabases List. */ +public final class SqlAvailabilityGroupDatabasesListSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/ListBySqlAvailabilityGroupDatabase.json + */ + /** + * Sample code: Gets all availability group databases associated with the availability groups . + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllAvailabilityGroupDatabasesAssociatedWithTheAvailabilityGroups( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlAvailabilityGroupDatabases().list("testrg", "testAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesUpdateSamples.java new file mode 100644 index 000000000000..7a4ad8867529 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabasesUpdateSamples.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseResource; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlAvailabilityGroupDatabases Update. */ +public final class SqlAvailabilityGroupDatabasesUpdateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/UpdateSqlAvailabilityGroupDatabase.json + */ + /** + * Sample code: Update a availability group replica. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updateAAvailabilityGroupReplica( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlAvailabilityGroupDatabaseResource resource = + manager + .sqlAvailabilityGroupDatabases() + .getWithResponse("testrg", "testSqlDatabase", "testsAG", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("mytag", "myval1")) + .withProperties( + new SqlAvailabilityGroupMultiDatabaseReplicaResourceProperties() + .withGroupDatabaseId("00000000-1111-2222-3333-444444444444") + .withValue( + Arrays + .asList( + new SqlAvailabilityGroupDatabaseReplicaResourceProperties() + .withReplicaName("sqlServer1") + .withIsLocal(true) + .withIsPrimaryReplica(true) + .withSynchronizationStateDesc("SYNCHRONIZED") + .withIsCommitParticipant(true) + .withSynchronizationHealthDesc("HEALTHY") + .withDatabaseStateDesc("ONLINE") + .withIsSuspended(false), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties() + .withReplicaName("sqlServer2") + .withIsLocal(false) + .withIsPrimaryReplica(false) + .withSynchronizationStateDesc("SYNCHRONIZED") + .withIsCommitParticipant(true) + .withSynchronizationHealthDesc("HEALTHY") + .withDatabaseStateDesc("ONLINE") + .withIsSuspended(false)))) + .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/SqlAvailabilityGroupReplicasCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasCreateSamples.java new file mode 100644 index 000000000000..c29f47f0abc2 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasCreateSamples.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.generated; + +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupConfigure; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupState; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResourceProperties; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlAvailabilityGroupReplicas Create. */ +public final class SqlAvailabilityGroupReplicasCreateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/CreateOrUpdateArcSqlAvailabilityGroupReplica.json + */ + /** + * Sample code: Create a Arc Sql Server availability group replica. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createAArcSqlServerAvailabilityGroupReplica( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlAvailabilityGroupReplicas() + .define("testSqlServerInstance") + .withRegion("southeastasia") + .withExistingSqlAvailabilityGroup("testrg", "testAG") + .withProperties( + new SqlAvailabilityGroupReplicaResourceProperties() + .withReplicaId("00000000-1111-2222-3333-444444444444") + .withReplicaName("testSqlServerInstance") + .withConfigure( + new AvailabilityGroupConfigure() + .withEndpointUrl("TCP://mytest60-0.mytest60-svc:5022") + .withAvailabilityModeDesc("SYNCHRONOUS_COMMIT") + .withFailoverModeDesc("EXTERNAL") + .withSessionTimeout(10) + .withPrimaryRoleAllowConnectionsDesc("ALL") + .withSecondaryRoleAllowConnectionsDesc("ALL") + .withBackupPriority(50) + .withSeedingModeDesc("AUTOMATIC")) + .withState( + new AvailabilityGroupState() + .withAvailabilityGroupReplicaRole("SECONDARY") + .withOperationalStateDesc("ONLINE") + .withRecoveryHealthDesc("ONLINE_IN_PROGRESS") + .withSynchronizationHealthDesc("HEALTHY") + .withConnectedStateDesc("CONNECTED") + .withLastConnectErrorDescription("") + .withLastConnectErrorTimestamp(OffsetDateTime.parse("2022-05-05T16: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/SqlAvailabilityGroupReplicasDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasDeleteSamples.java new file mode 100644 index 000000000000..91deac17d958 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasDeleteSamples.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 SqlAvailabilityGroupReplicas Delete. */ +public final class SqlAvailabilityGroupReplicasDeleteSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/DeleteArcSqlAvailabilityGroupReplica.json + */ + /** + * Sample code: Deletes a availability group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deletesAAvailabilityGroupResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlAvailabilityGroupReplicas() + .deleteWithResponse("testrg", "testsqlManagedInstance", "testAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasGetSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasGetSamples.java new file mode 100644 index 000000000000..f925f69e460c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasGetSamples.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 SqlAvailabilityGroupReplicas Get. */ +public final class SqlAvailabilityGroupReplicasGetSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/GetArcSqlAvailabilityGroupReplica.json + */ + /** + * Sample code: Retrieves an Arc Sql Server availability group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesAnArcSqlServerAvailabilityGroupResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlAvailabilityGroupReplicas() + .getWithResponse("testrg", "testSqlServerInstance", "testAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasListSamples.java new file mode 100644 index 000000000000..89c4d5cb5459 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasListSamples.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 SqlAvailabilityGroupReplicas List. */ +public final class SqlAvailabilityGroupReplicasListSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/ListBySqlAvailabilityGroupReplica.json + */ + /** + * Sample code: Gets all availability group replicas associated with the availability groups . + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllAvailabilityGroupReplicasAssociatedWithTheAvailabilityGroups( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlAvailabilityGroupReplicas().list("testrg", "testAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasUpdateSamples.java new file mode 100644 index 000000000000..f9d1a056b9b5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicasUpdateSamples.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.SqlAvailabilityGroupReplicaResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlAvailabilityGroupReplicas Update. */ +public final class SqlAvailabilityGroupReplicasUpdateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/UpdateSqlAvailabilityGroupReplica.json + */ + /** + * Sample code: Update a availability group replica. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updateAAvailabilityGroupReplica( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlAvailabilityGroupReplicaResource resource = + manager + .sqlAvailabilityGroupReplicas() + .getWithResponse("testrg", "testSqlServerInstance", "testsAG", 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/SqlAvailabilityGroupsCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsCreateSamples.java new file mode 100644 index 000000000000..41318b1b2d53 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsCreateSamples.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupProperties; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlAvailabilityGroups Create. */ +public final class SqlAvailabilityGroupsCreateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/CreateOrUpdateSqlAvailabilityGroup.json + */ + /** + * Sample code: Updates a SQL Availability Group tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updatesASQLAvailabilityGroupTags( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlAvailabilityGroups() + .define("testsqlAvailabilityGroup") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withTags(mapOf("mytag", "myval")) + .withProperties( + new SqlAvailabilityGroupProperties() + .withAvailabilityGroupName("myAvailabilityGroup") + .withAvailabilityGroupId("00000000-1111-2222-3333-444444444444") + .withInstanceName("testInstance") + .withCollectionTimestamp(OffsetDateTime.parse("2022-05-05T16:26:33.883Z")) + .withVersion(0) + .withBasicFeatures(false) + .withDtcSupport(false) + .withDbFailover(true) + .withIsDistributed(false) + .withClusterTypeDesc("WSFC") + .withRequiredSynchronizedSecondariesCommit(0) + .withIsContained(false)) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsDeleteSamples.java new file mode 100644 index 000000000000..ad5d7b7b8e0e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsDeleteSamples.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 SqlAvailabilityGroups Delete. */ +public final class SqlAvailabilityGroupsDeleteSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/DeleteSqlAvailabilityGroup.json + */ + /** + * Sample code: Delete a SQL Server Instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deleteASQLServerInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlAvailabilityGroups().delete("testrg", "testsqlAvailabilityGroup", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsGetByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..ef97ed2153b9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsGetByResourceGroupSamples.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 SqlAvailabilityGroups GetByResourceGroup. */ +public final class SqlAvailabilityGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/GetSqlAvailabilityGroup.json + */ + /** + * Sample code: Updates a SQL Server Instance tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updatesASQLServerInstanceTags( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlAvailabilityGroups() + .getByResourceGroupWithResponse("testrg", "testsqlAvailabilityGroup", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsListByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsListByResourceGroupSamples.java new file mode 100644 index 000000000000..dc3a64e92ed7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsListByResourceGroupSamples.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 SqlAvailabilityGroups ListByResourceGroup. */ +public final class SqlAvailabilityGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/ListByResourceGroupSqlAvailabilityGroup.json + */ + /** + * Sample code: Gets all SQL Server Instance in a resource group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllSQLServerInstanceInAResourceGroup( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlAvailabilityGroups().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsListSamples.java new file mode 100644 index 000000000000..8a8dac605a28 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsListSamples.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 SqlAvailabilityGroups List. */ +public final class SqlAvailabilityGroupsListSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/ListSubscriptionSqlAvailabilityGroup.json + */ + /** + * Sample code: Gets all SQL Availability Groups in a subscription. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllSQLAvailabilityGroupsInASubscription( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlAvailabilityGroups().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsUpdateSamples.java new file mode 100644 index 000000000000..1cede5028be0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupsUpdateSamples.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.SqlAvailabilityGroup; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlAvailabilityGroups Update. */ +public final class SqlAvailabilityGroupsUpdateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/UpdateSqlAvailabilityGroup.json + */ + /** + * Sample code: Updates a SQL Server Instance tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updatesASQLServerInstanceTags( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlAvailabilityGroup resource = + manager + .sqlAvailabilityGroups() + .getByResourceGroupWithResponse("testrg", "testsqlAvailabilityGroup", 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..d697e7bf294e 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,6 +4,7 @@ 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; @@ -11,6 +12,7 @@ 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.KeytabInformation; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SRaw; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SSpec; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceProperties; @@ -22,7 +24,7 @@ /** 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-03-15-preview/examples/CreateOrUpdateSqlManagedInstance.json */ /** * Sample code: Create or update a SQL Managed Instance. @@ -75,6 +77,9 @@ public static void createOrUpdateASQLManagedInstance( .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..eb251ecc4eb1 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-03-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..d4d0162747c5 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-03-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..8f46e7a317f6 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-03-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..34344343abcb 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-03-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..48ba301e6ef8 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-03-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/SqlServerAvailabilityGroupsCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateSamples.java new file mode 100644 index 000000000000..54d3ae9505e9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateSamples.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.generated; + +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupConfigure; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupState; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourceProperties; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlServerAvailabilityGroups Create. */ +public final class SqlServerAvailabilityGroupsCreateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/CreateOrUpdateArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Create a Arc Sql Server availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createAArcSqlServerAvailabilityGroup( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlServerAvailabilityGroups() + .define("testAG") + .withRegion("southeastasia") + .withExistingSqlServerInstance("testrg", "testSqlServerInstance") + .withProperties( + new SqlServerAvailabilityGroupResourceProperties() + .withAvailabilityGroupId("00000000-1111-2222-3333-444444444444") + .withAvailabilityGroupName("testAG") + .withConfigure( + new AvailabilityGroupConfigure() + .withEndpointUrl("TCP://mytest60-0.mytest60-svc:5022") + .withAvailabilityModeDesc("SYNCHRONOUS_COMMIT") + .withFailoverModeDesc("EXTERNAL") + .withSessionTimeout(10) + .withPrimaryRoleAllowConnectionsDesc("ALL") + .withSecondaryRoleAllowConnectionsDesc("ALL") + .withBackupPriority(50) + .withSeedingModeDesc("AUTOMATIC")) + .withState( + new AvailabilityGroupState() + .withAvailabilityGroupReplicaRole("SECONDARY") + .withOperationalStateDesc("ONLINE") + .withRecoveryHealthDesc("ONLINE_IN_PROGRESS") + .withSynchronizationHealthDesc("HEALTHY") + .withConnectedStateDesc("CONNECTED") + .withLastConnectErrorDescription("") + .withLastConnectErrorTimestamp(OffsetDateTime.parse("2022-05-05T16: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/SqlServerAvailabilityGroupsDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDeleteSamples.java new file mode 100644 index 000000000000..82a584b30723 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDeleteSamples.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 SqlServerAvailabilityGroups Delete. */ +public final class SqlServerAvailabilityGroupsDeleteSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/DeleteArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Deletes a availability group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deletesAAvailabilityGroupResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlServerAvailabilityGroups() + .deleteWithResponse( + "testrg", "testsqlInstanceAvailabilityGroup", "testAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsGetSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsGetSamples.java new file mode 100644 index 000000000000..a46f18995076 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsGetSamples.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 SqlServerAvailabilityGroups Get. */ +public final class SqlServerAvailabilityGroupsGetSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/GetArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Retrieves an Arc Sql Server availability group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesAnArcSqlServerAvailabilityGroupResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager + .sqlServerAvailabilityGroups() + .getWithResponse("testrg", "testSqlServerInstance", "testAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsListSamples.java new file mode 100644 index 000000000000..d946ef0cc552 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsListSamples.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 SqlServerAvailabilityGroups List. */ +public final class SqlServerAvailabilityGroupsListSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/ListBySqlServerInstanceAvailabilityGroup.json + */ + /** + * Sample code: Gets all availability groups associated with an Arc Enabled Sql server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllAvailabilityGroupsAssociatedWithAnArcEnabledSqlServer( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups().list("testrg", "testSqlServerInstance", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsUpdateSamples.java new file mode 100644 index 000000000000..96c8f94977fe --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsUpdateSamples.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.SqlServerAvailabilityGroupResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlServerAvailabilityGroups Update. */ +public final class SqlServerAvailabilityGroupsUpdateSamples { + /* + * x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-03-15-preview/examples/UpdateSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Update a availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updateAAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerAvailabilityGroupResource resource = + manager + .sqlServerAvailabilityGroups() + .getWithResponse("testrg", "testSqlServerInstance", "testAG", 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/SqlServerDatabasesCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesCreateSamples.java new file mode 100644 index 000000000000..1e5ccbadceee --- /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-03-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..ab525f3f80cc --- /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-03-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..8830e816c59c --- /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-03-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..89192caa0f99 --- /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-03-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..3db3a257db4b --- /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-03-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..0592ebd69c5b 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-03-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..fcd9959c956c 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-03-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..eec2f3dd9bba 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-03-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..0e24be501a8b 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-03-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..a35d5f287edb 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-03-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..47262fe3ddcd 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-03-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()); - } -}